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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Eric-De
Frequent Visitor

undefinedTest if a day is a weekday but don't used function weekday

Hello 

 

I need to test if a day is a weekday or not , I used a calandar table and table of usual date . I used the following commands 

 

FirstDayIsOH =
var result = CALCULATE(
COUNTROWS(TableHeuresBureau),
DATESBETWEEN(
TableHeuresBureau[Value],
'Sheet1'[Start],
'Sheet1'[Start]
),
TableHeuresBureau[JourSemaine] >=2 && TableHeuresBureau[JourSemaine] <= 6,
ALL('Sheet1')
)
return
if(ISBLANK(result),false,TRUE)

 

That running perfectly but I'm not satisfy by this , because it seem not a good code. 

If some people have a better code (used table calandar and table date? 

EricDe_0-1711532327675.png

 

I hope I'm clear

1 ACCEPTED SOLUTION

Hello Xiaoxin 

 

In fact, I need to determine if the day 'Sheet1'[Start] is a officeday or not.

But thank for your help 🙂

 

Best regards

View solution in original post

4 REPLIES 4
Eric-De
Frequent Visitor

Hello Xiaoxin 

 

Thank for this reply, but as I said, I would like to avoid using the weekday function. I have already this inforltion in the table and column TableHeuresBureau[JourSemaine]

 

Best regards

Anonymous
Not applicable

HI @Eric-De,

Perhaps you can try to use format function with 'w' optional parameter, it will return the text number of weekday of the current date based on regular weekday format(Sunday to Saturday) You only need to use Value function to convert it back to number.

FORMAT function (DAX) - DAX | Microsoft Learn

FirstDateIsWorkday =
VAR firstDate =
    MIN ( TableHeuresBureau[From] )
RETURN
    IF ( VALUE ( FORMAT ( firstDate, "w" ) ) < 6, "Y", "N" )

Regards,

Xiaoxin Sheng

Hello Xiaoxin 

 

In fact, I need to determine if the day 'Sheet1'[Start] is a officeday or not.

But thank for your help 🙂

 

Best regards

Anonymous
Not applicable

HI @Eric-De,

You can use the following measure formula to check if the first date is workday:

FirstDateIsWorkday =
VAR firstDate =
    MIN ( TableHeuresBureau[From] )
RETURN
    IF ( WEEKDAY ( firstDate, 2 ) < 6, "Y", "N" )

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.