Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Measure to determine time range

How to create a measure to determine if the truck is working(goods delivered) during the window --> (3am to 1pm) ?

I have data for 3 months/20 trucks in the below format and would like to create a report page that shows the performance of the truck by the percentage of times the truck has finished delivery within the above time window or not.

 

TruckGoods deliveredCustomerDate
Truck 11:45a9/02/2021
Truck 114:00b9/02/2021
Truck 23:45c10/12/2021
Truck 24:45d10/12/2021

 

for example - truck 1 has failed to deliver within the given time window(3am to 1pm), the output should be like below.

truck 1 - 0% and truck 2 - 100%

 

Any help would be greatly appreciated! Thank you.

  • Anonymous , Try a measure like

    divide(countx(filter(summarize(Table, Table[Truck], "_1",calculate(coutrows(Table), filter(Table,Table[Goods delivered] >=time(3,0,0) && Table[Goods delivered] <=time(13,0,0))),"_2",coutrows(Table)), [_1] =[2]),[Truck]) , distinctcount(Table[Truck]),0)

5 Replies

    • amitchandak's avatar
      amitchandak
      Icon for Super User rankSuper User

      Anonymous , Try a measure like

       

      divide(calculate(coutrows(Table), filter(Table,Table[Goods delivered] >=time(3,0,0) && Table[Goods delivered] <=time(13,0,0))),coutrows(Table))

      • Anonymous's avatar
        Anonymous
        Not applicable

        Sorry i should have been more clear on my requirement.

         

        We have business requirement as below example.

         

        If truck xyz fails to deliver within given time window.. even for 1 customer then it'll be 0% performance for given day.