Forum Discussion
Anonymous
6 years agoNot applicable
Current Week vs Prior Week (same year)
I would like to create a line chart showing showing my current week vs last week of a total value. I know I need 2 measures here, but the week time base equations I've tried are not working. I have...
- 6 years ago
I've done some extensive work with weeks. What I use is the following logic:
- Get the current week number for your data. Something like this:
Prior Year Sales = VAR CurrentWeek = MAXX( 'Sales', RELATED( 'Date'[Week of Year] ) ) VAR CurrentYear = MAXX( 'Sales', RELATED( 'Date'[Year] ) ) VAR PriorYearSales = SUMX( FILTER( ALL( Sales ), RELATED( 'Date'[Year] ) = CurrentYear - 1 && RELATED( 'Date'[Week of Year] ) = CurrentWeek ), Sales[SubTotal] ) RETURN PriorYearSalesYou an see the 2011 week sales 23-26 are showing in the prior year for 2012 for those same weeks.
Here is a link to my PBIX file if you want to tinker with it.
v-alq-msft
Community Support
6 years agoHi, Anonymous
If you take the answer of someone, please mark it as the solution to help the other members who have same problems find it more quickly. If not, let me know and I'll try to help you further. Thanks.
Best Regards
Allan