Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Past 30 days calculation

Hello, 

 

I am trying to calculate hours worked in the past 30 days. The formula was working and pulling the correct numbers until a new month started. Now, it won't pull in any values. Here is the equation I am using: 

 

Hours Worked Past 30 days =
Calculate( sum('MS TimeCard'[Hours]), DATESINPERIOD('MS TimeCard'[Work Date], TODAY(), -30, DAY))
 
I am needing this to always give me a rolling 30 days of hours worked, even when we change to a new month. Has anyone else experienced this or have any suggestions? 
 
Thank you!

3 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    You should be able to do this like the following:

     

    Hours Worked Past 30 days =
      SUMX(FILTER('MS TimeCard',[Work Date] <= TODAY() & [Work Date] >= TODAY() - 30),'MS TimeCard'[Hours])
  • Anonymous's avatar
    Anonymous
    Not applicable

    Is there a way to do this but from a specific/ fixed date as apposed to 'Today'?