Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago

New Measure

Hey guys, my given "Laikas" ( Time) below is in whole number format and I cant figure out new measure to return difference if the time exceeds 4:30 norm and if does not exceed 4:30 then return simply 00:00:00. Any ideas?

 

 

 

 

 

 

 

7 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      amitchandak 

      Yes, that's part of the measure, so I want to say that if Laikas(Time) exceeds 04:30:00 then return the difference between overtime and 04:30:00

      • amitchandak's avatar
        amitchandak
        Super User

        Anonymous , Evening 4 would be 16.

        Row context will play role in answer

         

        Try like

        if(max([Laikas]) >=time(4,30,0) , max([Laikas]) - time(4,30,0) , 0 )

        if(max([Laikas]) >=time(4,30,0) , max([Laikas]) - time(16,30,0) , 0 )

        or

        if(max([Laikas]) >=time(4,30,0) , datediff(max([Laikas]), time(4,30,0),minute) , 0 )
        if(max([Laikas]) >=time(4,30,0) , datediff(max([Laikas]), time(16,30,0),minute) , 0 )

         

        and a sum like

        sumx(Values(Table[Indeksas]), if(max([Laikas]) >=time(4,30,0) , datediff(max([Laikas]), time(16,30,0),minute) , 0 ))

         

        or

        sumx(Values(Table[Indeksas]), if(([Laikas]) >=time(4,30,0) , datediff(([Laikas]), time(16,30,0),minute) , 0 ))