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! Learn more

Reply
cwnoll
Frequent Visitor

Help needed with measure - compare current day of week to previous 20 wks, same day of week

I am trying to figure out how to compare a day of the week to an average of the previous 20 weeks, same day. So if I am looking at, Tuesday, 3/24/2020, I want to compare that to the average of the previous 20 Tuesdays.

 

any thoughts?

I thank you in advance, you all are ALWAYS so helpful!

1 ACCEPTED SOLUTION
v-lid-msft
Community Support
Community Support

Hi @cwnoll ,

 

We can use the following measure to meet your requirement.

 

Measure =

CALCULATE (

    AVERAGE ( 'Table'[values] ),

    FILTER (

        ALLSELECTED ( 'Table'[Date] ),

        'Table'[Date]>= MIN ( 'Table'[Date] ) - 2 * 7

        && 'Table'[Date] < MIN ( 'Table'[Date] )

        && WEEKDAY ( 'Table'[Date] ) = WEEKDAY ( MIN ( 'Table'[Date] ) )

    )

)

 

Then we can get the result like this,

 

32.png33.png34.png

 

 

 

 

And you can change the -2*7 to -20*7 to meet the average of the previous 20 Weeks.

If it doesn’t meet your requirement, could you please show the exact expected result based on the table that we have shared?

 

By the way, pbix file as attached.


Best regards,

 

Community Support Team _ Dong Li
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

3 REPLIES 3
v-lid-msft
Community Support
Community Support

Hi @cwnoll ,

 

How about the result after you follow the suggestions mentioned in my original post?Could you please provide more details about it If it doesn't meet your requirement?


Best regards,

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-lid-msft
Community Support
Community Support

Hi @cwnoll ,

 

We can use the following measure to meet your requirement.

 

Measure =

CALCULATE (

    AVERAGE ( 'Table'[values] ),

    FILTER (

        ALLSELECTED ( 'Table'[Date] ),

        'Table'[Date]>= MIN ( 'Table'[Date] ) - 2 * 7

        && 'Table'[Date] < MIN ( 'Table'[Date] )

        && WEEKDAY ( 'Table'[Date] ) = WEEKDAY ( MIN ( 'Table'[Date] ) )

    )

)

 

Then we can get the result like this,

 

32.png33.png34.png

 

 

 

 

And you can change the -2*7 to -20*7 to meet the average of the previous 20 Weeks.

If it doesn’t meet your requirement, could you please show the exact expected result based on the table that we have shared?

 

By the way, pbix file as attached.


Best regards,

 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Greg_Deckler
Community Champion
Community Champion

Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 

Second, WEEKNUM will get you the week number and WEEKDAY will tell you what day it is.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

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