Forum Discussion
ApurvaKhatri
8 years agoHelper III
Difference 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
8 years agoSolution Specialist
Hi 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
8 years agoHelper III
Thanks for the solution. But in my case, sales is a measure so its not working