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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
mp390988
Post Patron
Post Patron

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.