Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Rolling count per hour

Need help.

I have the below table (Columns: "Task ID" and "Receipt"). I need to calculate the column "Rolling total per hour" whcih is number of tasks recieved in the previous hours (an example of what I am trying to achieve is listed below).

Please help in providing the DAX fomula to create the calculated column. I tried to develop one as well as search the community but couldn't fine.

 

Table: Task Log

Task IDReceiptRolling total tasks per hour <<Calculated column>>
E49696112/1/19 12:00 AM1
E49696212/1/19 12:13 AM2
E49696312/1/19 12:14 AM3
E49696412/1/19 12:17 AM4
E49696512/1/19 12:20 AM5
E49696612/1/19 12:22 AM6
E49696712/1/19 12:28 AM7
E49696812/1/19 12:29 AM8
E49698112/1/19 1:26 AM3
E49698212/1/19 1:53 AM2
E49698312/1/19 1:53 AM3
E49698412/1/19 2:16 AM4
  • Hi,

    This calculated column formula works

    Column = CALCULATE(COUNTROWS(Data),FILTER(Data,Data[Receipt]>=EARLIER(Data[Receipt])-TIME(1,0,0)&&Data[Receipt]<=EARLIER(Data[Receipt])))

    Hope this helps.

5 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      Ashish_Mathur - It is counting the number of tasks recieved within the last hour only (including the current tasks), in this case number of tasks recieved between 12:26 AM and 1:26 AM (both time inclusive), hence 3

  • Hi,

    This calculated column formula works

    Column = CALCULATE(COUNTROWS(Data),FILTER(Data,Data[Receipt]>=EARLIER(Data[Receipt])-TIME(1,0,0)&&Data[Receipt]<=EARLIER(Data[Receipt])))

    Hope this helps.