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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
kristel_tulio
Helper III
Helper III

Count # of working days per month based on starting date of an employee

Hi,

 

I would like to ask for help. I have 2 tables (Date table & UserMap table). In user map I have name of managers and their hire date.

I would like to count the number of working days each month starting on their hire date.

2 ACCEPTED SOLUTIONS
kristel_tulio
Helper III
Helper III

Hi @daXtreme 

Thank you for that, I just have a question It seems the count is accumulating on my end.sample cal1.PNG sample cal 2.PNG

View solution in original post

v-yinliw-msft
Community Support
Community Support

Hi @kristel_tulio ,

 

You can try the following methods.

 

Measure:

Total Days M = 
VAR N1 =
    CALCULATE (
        COUNT ( 'Date'[Workday] ),
        FILTER (
            'Date',
            [Date] >= SELECTEDVALUE ( 'Table'[Date of entry] )
                && [Date] <= SELECTEDVALUE ( 'Table'[Date of separation] )
                && [Workday] = 1
        )
    )
VAR N2 =
    CALCULATE (
        COUNT ( 'Date'[Workday] ),
        FILTER (
            'Date',
            [Date] >= SELECTEDVALUE ( 'Table'[Date of entry] )
                && [Date] <= TODAY ()
                && [Workday] = 1
        )
    )
RETURN
    IF ( SELECTEDVALUE ( 'Table'[Date of separation] ) = BLANK (), N2, N1 )

 

 

 

employee IDDate of entryDate of separation
12/1/20225/1/2022
23/1/2022 
34/1/2022 
45/1/20228/31/2022
56/1/2022 
67/1/2022 

vyinliwmsft_0-1662628915008.png

Is this the result you expect?

 

Best Regards,

 

Community Support Team _Yinliw

 

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

6 REPLIES 6
v-yinliw-msft
Community Support
Community Support

Hi @kristel_tulio ,

 

You can try the following methods.

 

Measure:

Total Days M = 
VAR N1 =
    CALCULATE (
        COUNT ( 'Date'[Workday] ),
        FILTER (
            'Date',
            [Date] >= SELECTEDVALUE ( 'Table'[Date of entry] )
                && [Date] <= SELECTEDVALUE ( 'Table'[Date of separation] )
                && [Workday] = 1
        )
    )
VAR N2 =
    CALCULATE (
        COUNT ( 'Date'[Workday] ),
        FILTER (
            'Date',
            [Date] >= SELECTEDVALUE ( 'Table'[Date of entry] )
                && [Date] <= TODAY ()
                && [Workday] = 1
        )
    )
RETURN
    IF ( SELECTEDVALUE ( 'Table'[Date of separation] ) = BLANK (), N2, N1 )

 

 

 

employee IDDate of entryDate of separation
12/1/20225/1/2022
23/1/2022 
34/1/2022 
45/1/20228/31/2022
56/1/2022 
67/1/2022 

vyinliwmsft_0-1662628915008.png

Is this the result you expect?

 

Best Regards,

 

Community Support Team _Yinliw

 

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

Hi @v-yinliw-msft 

It's great! , This one works for me. Thanks a lot

kristel_tulio
Helper III
Helper III

Hi @daXtreme 

Thank you for that, I just have a question It seems the count is accumulating on my end.sample cal1.PNG sample cal 2.PNG

Well, since your code works differently to mine... your model/code is not equivalent. Find the difference and correct. That's all I can tell you.

Thank you @daXtreme 

daXtreme
Solution Sage
Solution Sage

Solution attached...

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.