Forum Discussion
Same Week Last Year
I need to implement week analysis. For the last year, how we can resolve week number difference.
Please help
Hi Anonymous
How about this?
https://www.barmartland.com/compare-sales-with-last-year-on-day-in-week/
Best Regards
Maggie
3 Replies
- amitchandakSuper User
Anonymous , Try with week Rank
new columns in date tbale
Week Start date = 'Date'[Date]+-1*WEEKDAY('Date'[Date],2)+1
Week End date = 'Date'[Date]+ 7-1*WEEKDAY('Date'[Date],2)
Week Number = WEEKNUM([Date],2)
Week = if('Date'[Week Number]<10,'Date'[Year]*10 & 'Date'[Week Number],'Date'[Year]&'Date'[Week Number])
Week Rank = RANKX(all('Date'),'Date'[Week Start date],,ASC,Dense)Measure
This Week = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])))
Last Week = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])-1))
Last year Week= CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=(max('Date'[Week Rank]) -52)))Refer by blog
- AnonymousNot applicable
But if the max of week number is different, how we can handle this
- v-juanli-msftCommunity Support
Hi Anonymous
How about this?
https://www.barmartland.com/compare-sales-with-last-year-on-day-in-week/
Best Regards
Maggie