Forum Discussion
Current Week Vs Previous Week values are not showing correctly.
- Anonymous4 years ago
Hi baijumohan1990 ,
If you want to compare the sum of the current week with the sum of the previous week. You can create a WeekNum column to return the week numbers.
WeekNum = WEEKNUM([Date],2)Then create a column to get the sum of previous week.
PreviousWeekValue = CALCULATE(SUM('Table'[Value]),FILTER('Table',[WeekNum]=EARLIER('Table'[WeekNum])-1))Also the current week.
CurrentWeekValue = CALCULATE(SUM('Table'[Value]),FILTER('Table',[WeekNum]=EARLIER('Table'[WeekNum])))If you want to compare the current day with the date corresponding to the previous week.
You can directly filter the date for the day minus 7.
Column = CALCULATE(SUM('Table'[Value]),FILTER('Table',[Date]=EARLIER('Table'[Date])-7))Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi baijumohan1990 ,
If you want to compare the sum of the current week with the sum of the previous week. You can create a WeekNum column to return the week numbers.
WeekNum = WEEKNUM([Date],2)
Then create a column to get the sum of previous week.
PreviousWeekValue = CALCULATE(SUM('Table'[Value]),FILTER('Table',[WeekNum]=EARLIER('Table'[WeekNum])-1))
Also the current week.
CurrentWeekValue = CALCULATE(SUM('Table'[Value]),FILTER('Table',[WeekNum]=EARLIER('Table'[WeekNum])))
If you want to compare the current day with the date corresponding to the previous week.
You can directly filter the date for the day minus 7.
Column = CALCULATE(SUM('Table'[Value]),FILTER('Table',[Date]=EARLIER('Table'[Date])-7))
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
thank you. it worked. I tried another solution with DATEADD that also worked. Now I confused why a fairly simple query not working when we compute the Last Week Sales with DATESBETWEEN. is DATESBETWEEN meant be for any other scenarios? Appreciate your inputs on this. thank you