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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Rahma
New Member

Week start day monday

Hello guys,

I need to check if the day is a weekend or not, knowing that the week should starting with Monday.

And to do it, i used weekday function.

But the result is not correct. I have tried all the options and these are the diffrent results i have:

weekday([date], 1) ===> Friday 1, saturday 2 , sunday 3

weekday([date], 2) ===> saturday 1, sunday 2, monday 3

weekday([date], 3) ===> saturday 0, sunday 1, monday 2

 

and what i need is that the number of monday should be 1 , saturday 6 and suday 7 as described in the documentation here :

https://learn.microsoft.com/fr-fr/dax/weekday-function-dax 

 

1 ACCEPTED SOLUTION

HI @Rahma,

I check the system calendar and find the 1/7/2019 is Monday, the weekday function with option 2 in your table also get the correctly weekday number 1.(Monday to Sunday: 1~7) Why you say this function get the works with wrong result?

1.PNG

IsWeekend =
IF ( WEEKDAY ( [Date], 2 ) > 5, 1, 0 )

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

6 REPLIES 6
Rahma
New Member

@v-shex-msft i use september 2022 version

@FreemanZ this is a screenshot for my dates table

Rahma_0-1672822269147.png

@jewel_at yes i created it, but the issue here is that saturday and sunday don't have the number 6 and 7 as expected. I added this column for my case 

IsWeekend = IF(WEEKDAY([Date],2) in { 1, 2} ,1,0)

HI @Rahma,

I check the system calendar and find the 1/7/2019 is Monday, the weekday function with option 2 in your table also get the correctly weekday number 1.(Monday to Sunday: 1~7) Why you say this function get the works with wrong result?

1.PNG

IsWeekend =
IF ( WEEKDAY ( [Date], 2 ) > 5, 1, 0 )

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

hi @Rahma 

2019/1/1 is Tuesday, weekday of 2. What is the issue?

v-shex-msft
Community Support
Community Support

HI @Rahma,

I test the weekday function with option parameter 2 and it work as expected. What version of power bi desktop are you worked on? Can you please share a pbix that can reproduce the issue to test?

How to Get Your Question Answered Quickly 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
FreemanZ
Super User
Super User

hi @Rahma 

 

weekday([date], 2) shall be what you expect. 

 

can you provide some screenshot on how:

weekday([date], 2) ===> saturday 1, sunday 2, monday 3?

 

 

jewel_at
Helper II
Helper II

You can create a new calculated column if you want it in DAX

 

 

IsWeekend = WEEKDAY('Table1'[Date]) IN {1,7}

 

 

 

Please let me know if that works!

 

Jewel

 

 

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 MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.