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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
msimmonsmcse
Helper I
Helper I

Counting working days

I have 2 tables, a Member table and a Date table. Some members have non-working days. I want to calculate the number of non working days for any filtered date range for each member. I have a Weekday column in the Date table that numbers each Day value 1-7, and a Non Working Days value in the Member table that identifies the Weekday value of a each members non work day. Members without non work days have null vallue. That value is a Conditional Column. What is the DAX to accomplish this in a measure?

 

Date Table:

DateWeekdayWeekday Name
1/1/20227Saturday
1/2/20221Sunday
1/3/20222Monday

 

Member Table:

NameNon Working Day
John Smithnull
Jessica Rabbit2
Homer Simpson6
1 ACCEPTED SOLUTION
v-angzheng-msft
Community Support
Community Support

Hi, @msimmonsmcse 

Try to create a measure like this:

Measure = 
var _TotalDays=
CALCULATE(
    COUNT('DataTable'[WeekDay]),
    REMOVEFILTERS('Member Table'[Name])
)
var _non_workingDays=
CALCULATE(
    COUNT('DataTable'[WeekDay]),
    FILTER('DataTable','DataTable'[WeekDay] in VALUES('Member Table'[Non Working Day])))
var _result=_TotalDays-_non_workingDays
return _result

Result:

vangzhengmsft_0-1642486590813.png

Please refer to the attachment below for details.

Hope this helps.

 

 

Best Regards,
Community Support Team _ Zeon Zheng

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-angzheng-msft
Community Support
Community Support

Hi, @msimmonsmcse 

Try to create a measure like this:

Measure = 
var _TotalDays=
CALCULATE(
    COUNT('DataTable'[WeekDay]),
    REMOVEFILTERS('Member Table'[Name])
)
var _non_workingDays=
CALCULATE(
    COUNT('DataTable'[WeekDay]),
    FILTER('DataTable','DataTable'[WeekDay] in VALUES('Member Table'[Non Working Day])))
var _result=_TotalDays-_non_workingDays
return _result

Result:

vangzhengmsft_0-1642486590813.png

Please refer to the attachment below for details.

Hope this helps.

 

 

Best Regards,
Community Support Team _ Zeon Zheng

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

AlexisOlson
Super User
Super User

I think you can write the base logic along these lines:

Non-Working Day Count =
VAR NonWorkDay = SELECTEDVALUE ( Member[Non Working Day] )
RETURN
    COUNTROWS ( FILTER ( DateTable, DateTable[Weekday] <> NonWorkDay ) )

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.