1 2 Previous Next 22 Replies Latest reply on Apr 7, 2016 2:50 AM by Ɓukasz Majewski

    DATEDIFF with condition - tracking working time

    Piotr Adamczyk

      Hello Tableau Community,

       

      This is my first post on Tableau Forum. So, I would like to say hello to all Tableau community!.

      Could you help me with one issue connected with DATEDIFF function.

      I want to count working time with start/stop condition.

       

      My raw data looks like that:

      Zrzut ekranu 2015-11-03 o 11.11.19.png

      We have an ID of workers (Name), type of record "start / stop" and date&time.

      I want to count for each worker length (in hours/minutes) of working time for each day.

      For eg as an output I want to show on the chart worker X in 02.11.2015 works 8:35h so he/she has 35minutes overtime.

       

      I have tried to count it like below:

       

      Calc1: IF [Start/Stop]='stop' then 'stop' end

      Calc2: IF [Start/Stop]='start'' then 'start' end

      Calc3: datediff('hour', [calc2] , [calc1])

       

      When I tried to prepare simple chart it doesn't work. Why?

       

      Zrzut ekranu 2015-11-03 o 11.19.55.png

       

      I guess that I have made very simple logical mistake but please help me

       

      Thanks in advance and regards!

      Peter

        1 2 Previous Next