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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
TaufikMaggangka
Helper II
Helper II

Weekly Date-Start Date and End Date

Hi All,

I am trying to create weekly range column(from monday to saturday) using addtional column week start date and week end date, but then realized that the start date not started in first date of the month as well as the week and date not end in last of the month. Here the dax i am used : 
Start date :

Week Start Date = Sheet1[Date] - WEEKDAY(Sheet1[Date],2)+1

end date: 

Week End Date = Sheet1[Date] - WEEKDAY(Sheet1[Date],2)+6


Basically, I want to start date always in the first day of the month basically day 1(for instance 1 september) and end date in 31 or 30 (for instance 30 september).

Anyone can help with this, please also see my atatched pbix here :
https://drive.google.com/file/d/143dko9boxjZuBkhxBTQQlhOiWW0t3HEP/view?usp=sharing

I hope there were an expert can help, I am quite new in the Power BI.

2 ACCEPTED SOLUTIONS

@TaufikMaggangka , Please find the attached file. with some minor changes

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

V-pazhen-msft
Community Support
Community Support

@TaufikMaggangka 
I used those 4 columns to achieve your requirement, see pbix at the end.

new week range.PNG

 

Basically I split the days into 5 groups with 6 days each because you want the new week to be Monday to Saturdays.

Vpazhenmsft_1-1636082510840.png

 

 

Then I use Rankx to get the new weekday.\

New weekday = RANKX(FILTER(Sheet1,[Year]=EARLIER([Year])&&[Month]=EARLIER([Month])&&[Day (bins)]=EARLIER([Day (bins)])),Sheet1[Day],,ASC)

 

 

Best regards
Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
TaufikMaggangka
Helper II
Helper II

hi @amitchandak ,
Thank you so much for help.
I try your suggestion based on the PBIX file that you send, it working fine until I got a first daay of the month that start in sunday.  Please see image attached.

Basically, I need the start of the week for each monday is start from monday. Try to find any sollutions but stuck, but I found that maybe it can be fix it if start of the month dax is change to start from Monday.
Is it possible to change the query for the start month is start from monday. Screenshot 2022-06-17 144823.png

V-pazhen-msft
Community Support
Community Support

@TaufikMaggangka 
I used those 4 columns to achieve your requirement, see pbix at the end.

new week range.PNG

 

Basically I split the days into 5 groups with 6 days each because you want the new week to be Monday to Saturdays.

Vpazhenmsft_1-1636082510840.png

 

 

Then I use Rankx to get the new weekday.\

New weekday = RANKX(FILTER(Sheet1,[Year]=EARLIER([Year])&&[Month]=EARLIER([Month])&&[Day (bins)]=EARLIER([Day (bins)])),Sheet1[Day],,ASC)

 

 

Best regards
Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@TaufikMaggangka , Week that start with month start date and +7 days after that

 

Week Start at Month = eomonth([Date],-1)+0
Week No = QUOTIENT(datediff([Week Start at Month],[Date],day) ,7)+1
Week Start Date =[Week Start at Month] + QUOTIENT(datediff([Week Start at Month],[Date],day) ,7)*7
Week End Date = if([Week Start Date] +7 <=eomonth([Date],0), [Week Start Date] +7 ,eomonth([Date],0))

 

 

Conrolling the week

 

Start Month = STARTOMONTH('Date'[Date]) // or // eomonth([Date],-1)+0
WeekDay = WEEKDAY([Date],2) //monday
Start of Week = if([Start Month]> [Date] -[WeekDay]+1 , [Start Month] , [Date] -[WeekDay]+1 )  //monday
Month Week = QUOTIENT(DATEDIFF(Minx(FILTER('Date',[Start Month]=EARLIER([Start Month])),'Date'[Start of Week]),[Date],DAY),7)+1

 

Week End date = if( eomonth([Date,0]) < 'Date'[Date]+ 7-1*WEEKDAY('Date'[Date],2), eomonth([Date,0]) , 'Date'[Date]+ 7-1*WEEKDAY('Date'[Date],2))

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thanks so much @amitchandak ,
would you like to send me the pbix file. it will be really helpfull ?

@TaufikMaggangka , Please find the attached file. with some minor changes

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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