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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Anonymous
Not applicable

Counting days excluding holiday and weekends

There is a couple of messages regarding this but I have found the easiest might be this code by creating a calendar table and number 1-7 the days. But I also included a number 8 for publich holiday. This code also counts if start date and end date is on the same date that it is 1 where a lot does not count it. The problem that I'm facing is in the or statement where it looks like you can only have two arguments where I need their either 1, 7 and 😎 as listed below

 

Counting =
CALCULATE (
COUNTROWS ( 'Calendar' ),
FILTER (
'Calendar',
AND (
'Calendar'[Date] >= 'Leave'[Leave Start Date],
'Calendar'[Date] <= Leave[Leave End Date]
)
),
OR ( 'Calendar'[DayNumber] = 1, 'Calendar'[DayNumber] = 7, 'Calendar'[DayNumber] = 8 )
1 ACCEPTED SOLUTION

Hi @Anonymous 

 

Try this then as a cal. column:

Counting =
CALCULATE (
    COUNTROWS ( 'Calendar' ),
    FILTER (
        ALL ( 'Calendar' ),
        'Calendar'[Date] >= 'Leave'[Leave Start Date]
            && 'Calendar'[Date] <='Leave'[Leave End Date]
            && 'Calendar'[DayNumber] IN { 2, 3, 4, 5, 6 }
    )
)

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

As a calculated colomn

NoLeave StartLeave End
10023/03/202123/03/2021
20025/03/202130/03/2021
10026/03/202128/03/2021
3001/04/20213/04/2021
30010/04/202111/04/2021

Hi @Anonymous 

 

Try this then as a cal. column:

Counting =
CALCULATE (
    COUNTROWS ( 'Calendar' ),
    FILTER (
        ALL ( 'Calendar' ),
        'Calendar'[Date] >= 'Leave'[Leave Start Date]
            && 'Calendar'[Date] <='Leave'[Leave End Date]
            && 'Calendar'[DayNumber] IN { 2, 3, 4, 5, 6 }
    )
)

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

Anonymous
Not applicable

Thanks for the quick response. I tried it but it just returns blanks although should be days to count

@Anonymous 

 

Can you pleae share a sample of your tables in a text format?

 

Do want a measure? or calculated column?

 

Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

VahidDM
Super User
Super User

Hi @Anonymous 

 

Try this:

Counting =
CALCULATE (
    COUNTROWS ( 'Calendar' ),
    FILTER (
        ALL ( 'Calendar' ),
        'Calendar'[Date] >= MAX ( 'Leave'[Leave Start Date] )
            && 'Calendar'[Date] <= MAX ( 'Leave'[Leave End Date] )
            && 'Calendar'[DayNumber] IN { 2, 3, 4, 5, 6 }
    )
)

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.