Forum Discussion
ApurvaKhatri
Helper III
8 years agoDifference between previous week and this week data
Hello, I have data as follows Date Sales Oct 4 - 36 Oct 11 - 30 Oct 18 - 25 Oct 25 - 20 I need the difference between this week and previous week data i.e Oct 25 - Oct 18 20 ...
BILASolution
Solution Specialist
8 years agoHi ApurvaKhatri
The trick is get an index calculated column to sort Weeks. (You can use power query)
This is the result
And the measures in my case are...
Total Sales = SUM(Sales[Sales])
Total Sales PW = var thisweek = FIRSTNONBLANK(Sales[Index];1) var prevweek = LOOKUPVALUE(Sales[Index];Sales[Index];thisweek-1) return CALCULATE([Total Sales];ALL(Sales[Date]);Sales[Index] = prevweek)
Variance = [Total Sales] - [Total Sales PW]
I hope this helps
Regards
BILASolution
ApurvaKhatri
Helper III
8 years agoThanks for the solution. But in my case, sales is a measure so its not working