View My Drafts
I have table like this
Now I want to show current Current week, Last one week, Last two weeks, Last three weeks ,Last four Weeks "ACC_Total". How to write dax for this I'm taking date from Date column
Agree with @Hugh Johnson ...Setup up your calendar with 'Offset' columns. I always include Days offset, Weeks Offset, Months Offset, and Years Offset. Makes it easy then to specify exactly what time-period you want to calculate in the measure.
here are a few DAX examples:- Sales total for 2 years ago,
Sales -2Yr = CALCULATE (SUM ( 'Sales'[Sales] ),'Date'[yrOffset] = -2)
- Same Month, 2 years ago
Sales Same Month -2yrs = CALCULATE (SUM ( 'Sales'[Sales] ),'Date'[monthOffset] = -24)
- Sales 17 weeks ago
Sales 17 weeks ago = CALCULATE (SUM ( 'Sales'[Sales] ),'Date'[weekOffset] = -17)
... etcyou get the idea - extremely flexible especially with weeks which is not included in the time intelligence calculations.