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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
mp390988
Helper V
Helper V

How to pass a list of holidays to the NETWORKDAYS function

Hi,

 

I have a list of holidays in my Calendar table as per below:

mp390988_0-1753353551513.png


I am trying to work out the DailyAvg as follows:

DailyAvg = 
VAR TotalRevenue = CALCULATE(SUM(DealerTrgts[Revenue]))


VAR NumDays = NETWORKDAYS(
    DATE(YEAR(TODAY()), MONTH(TODAY()),1), 
    TODAY(),
    1,
    FILTER(
        ALL('Calendar'[Date]),
        'Calendar'[Date]=TODAY() && 'Calendar'[IsHoliday] = 1
    )
)
RETURN IF(
    NumDays > 0, 
    round(TotalRevenue / NumDays,2), 
    0
)


But it is complaining saying a single value for column 'IsHoliday' in table 'Calendar' cannot be determined. This can happen when a measure or function formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or um to get a single result.

Anyone know how to pass a list of holidays to the NETWORKDAYS function?

 

Thanks

1 ACCEPTED SOLUTION
rohit1991
Super User
Super User

Hi @mp390988 ,


The NETWORKDAYS function in DAX needs a single-column table of holiday dates not a filter, not a boolean, just the dates. If your Calendar table has [Date] and [IsHoliday], you want to grab only the holiday dates and pass those in. Here’s what works for me:
DailyAvg =
VAR TotalRevenue = CALCULATE(SUM(DealerTargets[Revenue]))
VAR NumDays =NETWORKDAYS( DATE(YEAR(TODAY()), MONTH(TODAY()), 1),TODAY(),
SELECTCOLUMNS(
FILTER('Calendar', 'Calendar'[IsHoliday] = 1),
"HolidayDate", 'Calendar'[Date]
))RETURN
IF(NumDays > 0,ROUND(TotalRevenue / NumDays, 2),0)

 

Why this works:

  • SELECTCOLUMNS(..., "HolidayDate", 'Calendar'[Date]) makes sure you’re passing exactly what NETWORKDAYS wants: just the date column for your holidays.

If your [IsHoliday] column uses something other than 1/0 (like TRUE/FALSE or Yes/No), just tweak the filter bit to match. If you have a separate Holidays table, it’s even easier just pass the [Date] column from that table as your holidays argument.

 


Did it work? ✔ Give a Kudo • Mark as Solution – help others too!

View solution in original post

2 REPLIES 2
danextian
Super User
Super User

Hi @mp390988 

Holidays should be a single column only but you're retunng a filtered table with multipole columns. Also, if you need the first day of the month, it's been re-written as below.

DailyAvg =
VAR TotalRevenue =
    CALCULATE ( SUM ( DealerTrgts[Revenue] ) )
VAR StartDate =
    EOMONTH ( TODAY (), -1 ) + 1
VAR EndDate =
    TODAY ()
VAR Holidays =
    CALCULATETABLE ( VALUES ( 'Calendar'[Date] ), 'Calendar'[IsHoliday] = 1 )
VAR NumDays =
    NETWORKDAYS ( StartDate, EndDate, 1, Holidays )
RETURN
    IF ( NumDays > 0, ROUND ( TotalRevenue / NumDays, 2 ), 0 )

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
rohit1991
Super User
Super User

Hi @mp390988 ,


The NETWORKDAYS function in DAX needs a single-column table of holiday dates not a filter, not a boolean, just the dates. If your Calendar table has [Date] and [IsHoliday], you want to grab only the holiday dates and pass those in. Here’s what works for me:
DailyAvg =
VAR TotalRevenue = CALCULATE(SUM(DealerTargets[Revenue]))
VAR NumDays =NETWORKDAYS( DATE(YEAR(TODAY()), MONTH(TODAY()), 1),TODAY(),
SELECTCOLUMNS(
FILTER('Calendar', 'Calendar'[IsHoliday] = 1),
"HolidayDate", 'Calendar'[Date]
))RETURN
IF(NumDays > 0,ROUND(TotalRevenue / NumDays, 2),0)

 

Why this works:

  • SELECTCOLUMNS(..., "HolidayDate", 'Calendar'[Date]) makes sure you’re passing exactly what NETWORKDAYS wants: just the date column for your holidays.

If your [IsHoliday] column uses something other than 1/0 (like TRUE/FALSE or Yes/No), just tweak the filter bit to match. If you have a separate Holidays table, it’s even easier just pass the [Date] column from that table as your holidays argument.

 


Did it work? ✔ Give a Kudo • Mark as Solution – help others too!

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.