Forum Discussion
Same Week last Year Flag
Anonymous -> Try using the below:
Logic steps:
1- create a column that would return your current year's week number (using WEEKNUM())
eg-WeekNum =WEEKNUM([Date])
2- Create a column called WeekYear = [WeekNum] * 10000 + [Year]
eg- 12022, 22022,32022... for 1st week of 2022, 2nd week of 2022, 3rd week of 2022 and so on respectively.
3- Create another column Week_Last_Year = [WeekYear] -1
eg- (if WeekYear is 22022 then Week_Last_year will be 22021)
4- Create a measure called TOTALSALES=sum(totalsales)
5- Create a measure for current week
Current_week = WEEKNUM(TODAY()) * 10000 + YEAR(TODAY())
6-Create measure for current week's sales
Current_Week_Sales= Calculate ([TotalSales],Filter(ALL(Calendartable), [WeekYear] = [Current_week ] ))
7. Create a measure called LastYear_SameWeekSales = Calculate ([TotalSales],Filter(ALL(Calendartable), [WeekLastYear] = [Current_Week] - 1))
Using this, you can compare your Sales at the same time this year and last year.
Please mark it as a solution if this helps you. Thanks.
Regards,
TruptiS