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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.