Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers!
Enter the sweepstakes now!Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.
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
Solved! Go to 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?
IsWeekend =
IF ( WEEKDAY ( [Date], 2 ) > 5, 1, 0 )
Regards,
Xiaoxin Sheng
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?
IsWeekend =
IF ( WEEKDAY ( [Date], 2 ) > 5, 1, 0 )
Regards,
Xiaoxin Sheng
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
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?
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
User | Count |
---|---|
18 | |
16 | |
15 | |
13 | |
12 |
User | Count |
---|---|
10 | |
8 | |
8 | |
7 | |
6 |