Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
Hello,
I'd like to know how to make a dynamic WoW comparison. I have 14 days of sales data that is updated daily.
So for example, on Monday days 1-7 are aggregated and a variance is shown for the aggregate of days 8-14 (Week 1 vs Week 2). On Tuesdays, the previous day, Monday, is compared to the previous Monday in the dataset. On Wednesdays, the aggregate of the most recent Monday & Tuesday is compared to the aggregate of the Monday & Tuesday in the previous week. This logic follows up to Sunday, where the aggregate of the full week completed is compared to the previous full week.
For reference, the sales data has dates and day of the week names.
Thanks for any help of guidance in advance,
C
Solved! Go to Solution.
Hi @Anonymous ,
Here are the steps you can follow:
1. Create measure.
Flag =
var _today=
TODAY()
var _week=
WEEKNUM(_today,2)
var _weekday=
WEEKDAY(_today,2)
return
SWITCH(
TRUE(),
_weekday=1 && MAX('Table'[Week]) in {_week,_week-1},1,
_weekday<>1 &&
MAX('Table'[Date]) in
SELECTCOLUMNS(FILTER(ALL('Table'),OR('Table'[Week]=_week&&'Table'[Weekday] <_weekday,'Table'[Week]=_week-1&&'Table'[Weekday] <_weekday)),"date",'Table'[Date])
,1,0)
Measure =
SUMX(
FILTER(ALLSELECTED('Table'),
'Table'[Week]=MAX('Table'[Week])),[Value])
2. Place [Flag]in Filters, set is=1, apply filter.
3. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi @Anonymous ,
Here are the steps you can follow:
1. Create measure.
Flag =
var _today=
TODAY()
var _week=
WEEKNUM(_today,2)
var _weekday=
WEEKDAY(_today,2)
return
SWITCH(
TRUE(),
_weekday=1 && MAX('Table'[Week]) in {_week,_week-1},1,
_weekday<>1 &&
MAX('Table'[Date]) in
SELECTCOLUMNS(FILTER(ALL('Table'),OR('Table'[Week]=_week&&'Table'[Weekday] <_weekday,'Table'[Week]=_week-1&&'Table'[Weekday] <_weekday)),"date",'Table'[Date])
,1,0)
Measure =
SUMX(
FILTER(ALLSELECTED('Table'),
'Table'[Week]=MAX('Table'[Week])),[Value])
2. Place [Flag]in Filters, set is=1, apply filter.
3. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information or anything not related to the issue or question.
If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Please show the expected outcome based on the sample data you provided.
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...