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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
Syndicate_Admin
Administrator
Administrator

Days elapsed of a month, without holidays and only working days.

Hello!

I need to be able to obtain a measure that will give me back the number of working days elapsed in the month, taking into account today and the holidays that have been in the month. -

Data:

Month November

Public Holidays: 1 ( 21/11/22 ).-

Working days: 21 ( working days = Monday to Friday ).

Expected result (as of 11/27/22):

Working days: 18

I have created a calendar table, which I have linked with the Holidays table and I have determined the working days "Working Day".-

Msuarez_0-1669664797331.png

I will appreciate your answer.

1 ACCEPTED SOLUTION

Hi, @Syndicate_Admin ;

Try this, it should work:

count = 
CALCULATE(COUNT('Table'[Working Day]),FILTER('Table',[Date]<TODAY()&& 'Table'[Working Day]="Yes"))

Or

count =
CALCULATE (
    COUNT ( 'Table'[Working Day] ),
    FILTER (
        'Table',
        EOMONTH ( [Date], 0 ) = EOMONTH ( TODAY (), 0 )
            && [Date] < TODAY ()
            && 'Table'[Working Day] = "Yes"
    )
)

 
Best Regards,
Community Support Team _ Yalan Wu
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-yalanwu-msft
Community Support
Community Support

Hi, @Syndicate_Admin ;

Try it.

count = 
CALCULATE(COUNT('Table'[Working Day]),FILTER('Table',[Date]<DATE(2022,11,27)&& 'Table'[Working Day]="Yes"))

the final show:

vyalanwumsft_0-1669689202243.png

In additional, Expected result (as of 11/27/22): why is  "as of 11/27/22"?

Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Hello!

Thank you for your reply.

QUizas do not express me correctly.- The date 27/11 was just an example to be able to visualize an expected result.-

It is not necessary to put filters on any date, I just need you to tell me the working days that have elapsed of the month.

As if to give another example, today 29/11/22 the result should be 19 days elapsed of the 21 working days of the month of November.

I hope it has been clear and that you can with that info help me.-

Thank you.

Hi, @Syndicate_Admin ;

Try this, it should work:

count = 
CALCULATE(COUNT('Table'[Working Day]),FILTER('Table',[Date]<TODAY()&& 'Table'[Working Day]="Yes"))

Or

count =
CALCULATE (
    COUNT ( 'Table'[Working Day] ),
    FILTER (
        'Table',
        EOMONTH ( [Date], 0 ) = EOMONTH ( TODAY (), 0 )
            && [Date] < TODAY ()
            && 'Table'[Working Day] = "Yes"
    )
)

 
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks a lot! It works!!

mangaus1111
Solution Sage
Solution Sage

Hi @Syndicate_Admin ,

I think first you have to create a measure to count the business days:

Business Days =

CALCULATE(

             COUNTROWS('Date'),

             'Date'[Dia Laborial] ="Si"

              )

then another measure for the calculation month-to-date:

 

Business Days MTD =

CALCULATE(

       [Business Days],

       DATESMTD('Date'[Date])

          )

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

Hello, Thank you for your prompt response.-

The measure that tells me the number of working days of the month, I already had calculated:

Qty. working days = CALCULATE(COUNT(Calendar[Working Day]),Calendar[Working Day] = "Yes")
Create the new measure, according to what you understood you should take as data, as follows:
Qty. days Elapsed = CALCULATE([Cant. dias Laboral],DATESMTD(Calendar[Date]))
But it gives me back the same result as the previous measure (21), when it should have brought me 18
Maybe this taking some table data wrong?
Thanks for the help

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.