Forum Discussion
cham
7 years agoPost Patron
Difference between previous week data
Hi ,
I used following measures to calculate difference between previous week data,
table = Calendar (dateStart;dateEnd)
Measure = calculate(sum('Sheet1'[Total]),
filter('Table', 'Table'[Column] = WEEKNUM(max('Sheet1'[Date]),1)))
Measure 2 = calculate(sum('Sheet1'[Total]),
filter('Table', 'Table'[Column] = WEEKNUM(max('Sheet1'[Date]),1)-1))
Measure 3 = [Measure]/[Measure 2] - 1
But it didnt work, Following are my results,
Regards,
Cham
8 Replies
- AnonymousNot applicable
cham - You can use a variable in your "previous week" measure:
Measure 2 = var prev_week_num = WEEKNUM(max('Sheet1'[Date]),1)-1 calculate( sum('Sheet1'[Total]), 'Table'[Column] = prev_week_num )Hope this helps,
Nathan
- chamPost Patron
Hi Anonymous
Do I need to only use this measure to calculate the difference between previous week data?
Regards,
Cham
- AnonymousNot applicable
cham - No, I was substituting the measure 2 with the one I mentioned.
Also, parry2k gave good advice about adding a date table to your model. That table can include WeekNumber and it would be best to also have a "RelativeWeek" or "WeekKey" which is what you would use to calculate the previous week. If you need assistance with that, let us know.
The solution I provided will not actually work when the weeks go across years.