Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Dynamic Week on Week comparison

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

1 ACCEPTED SOLUTION
Anonymous
Not applicable

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.

vyangliumsft_0-1707198154652.png

3. Result:

vyangliumsft_1-1707198154653.png

 

 

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

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

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.

vyangliumsft_0-1707198154652.png

3. Result:

vyangliumsft_1-1707198154653.png

 

 

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

lbendlin
Super User
Super User

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...

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors