Forum Discussion
Week over Week Change - CROSS YEARs
- 5 years ago
Hi, Anonymous
Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.
Table:
Date(a calculated table):
Date = ADDCOLUMNS( CALENDARAUTO(), "YearWeek", YEAR([Date])*100+WEEKNUM([Date]) )There is a relationship between two tables. You may create a measure as below.
Result = var lastweeknum = CALCULATE( MAX('Date'[YearWeek]), FILTER( ALL('Date'), [YearWeek]<MAX('Date'[YearWeek]) ) ) var lastweekamount = CALCULATE( SUM('Table'[Impressions]), FILTER( ALL('Date'), [YearWeek]=lastweeknum ) ) return DIVIDE( SUM('Table'[Impressions])-lastweekamount, lastweekamount, 0 )Result:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, Anonymous
Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.
Table:
Date(a calculated table):
Date =
ADDCOLUMNS(
CALENDARAUTO(),
"YearWeek",
YEAR([Date])*100+WEEKNUM([Date])
)
There is a relationship between two tables. You may create a measure as below.
Result =
var lastweeknum =
CALCULATE(
MAX('Date'[YearWeek]),
FILTER(
ALL('Date'),
[YearWeek]<MAX('Date'[YearWeek])
)
)
var lastweekamount =
CALCULATE(
SUM('Table'[Impressions]),
FILTER(
ALL('Date'),
[YearWeek]=lastweeknum
)
)
return
DIVIDE(
SUM('Table'[Impressions])-lastweekamount,
lastweekamount,
0
)
Result:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous5 years agoNot applicable
Thanks a lot for the help! v-alq-msft