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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register 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
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.