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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
mstan
Frequent Visitor

DAX for Full Weeks Only (Sunday - Saturday) in Previous Month

Hi Everyone,


I am looking for a way to capture data only from days in the (1)previous month which are (2)part of a full Sunday - Saturday week.

 

For example, I would only want to see data from Janury 1st - 28th of 2023, since 29-31 are not part of a full calendar week in January.  Additionally, if the 1st had fallen on any date other than Sunday, I would not want to see that or any dates prior to the first Sunday of the month.

 

mstan_1-1674845690934.png

 

My date table should have everything I need through a combination of Year/Month/WeekNum/WeekdayName/WeekdayNumber/WeekStartDate/WeekEndDate, etc... but I'm having trouble putting it all together.

 

I found this solution, but it appears to be rolling days in the previous month into the days in week count:

week_Max =
IF (
    data[Year_Week] = MAX ( data[Year_Week] );
    "week_Max";
    IF ( data[Year_Week] = MAX ( data[Year_Week-1] ); "week_Max-1" )

 

 If anyone has a solution they can share, I would be greatly appreciative!

2 REPLIES 2
FreemanZ
Super User
Super User

hi @mstan 

What do you going to do with the captured days?

What do you going to do with imcomplete days, like 29-31 Jan and 1-4 Feb?

Thanks for the response!

 

I have to recreate a matrix with statuses, and the average of statuses received for each workday in the previous month, which would be the count of status divided by number of weeks (or count of  weekday) in the month:

 

  Sunday  Monday  Tuesday  Wednesday  Thursday  Friday  Saturday 
Status A 299274256216215253197
Status B 5655938
Status C 72845963887692

 

at the request of my partners, the incomplete days should be omitted from the data completely.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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