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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
cwnoll
Frequent Visitor

Previous Day compared to YTD Avg of Same day of week (DAX Help Please)

I am trying to compare a total from Monday (4/6), with the YearToDate Average of the same day of week. For example, I want to compare the total from Monday (yesterday) to the YTD average for all Monday's this year. FYI on example data below, I removed all other dates besides Monday in effort to save space. The original data source has all days.

 

DateWeekDayAnswers   
4/6/2020Monday914 Monday914
3/30/2020Monday830 Monday YTD Avg1046
3/23/2020Monday915 Monday Diff-132
3/16/2020Monday1009   
3/9/2020Monday1069   
3/2/2020Monday1143   
2/24/2020Monday1099   
2/17/2020Monday1044   
2/10/2020Monday1082   
2/3/2020Monday1093   
1/27/2020Monday1154   
1/20/2020Monday942   
1/13/2020Monday1143   
1/6/2020Monday1073   
3/23/2020Monday915   

 

3 REPLIES 3
Greg_Deckler
Super User
Super User

All Mondays = AVERAGEX(FILTER('Table',YEAR([Date]) = YEAR(EARLIER([Date])) && [WeekDay] = "Monday"),[Answers])

@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

will give it a shot, thank you for quick response. the goal is for this to be a moving target for each day. So tomorrow obviously i would be doing this for Tuesday. Would you just create a var for current day of week -1 so that it would auto change each day, or different measures for the days?

 

man i hope that made sense.

@cwnoll , Same weekday is 364 days behind, use with date calendar

Week Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-364,DAY))

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.