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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
HearnTexas
New Member

Why is NETWORKDAYS Not working for me correctly?

Hello,

I'm new to posting questions in this community. I can usually find my answer, but I cannot find why this DAX measure is not working. Below is my measure and below the measure is an image of what it is returning. 

 

Days Left in Fiscal Year =
VAR CurrentDate = 'Calendar TB'[Date]
VAR FiscalYearEnd =
    IF(
        MONTH(CurrentDate) >= 10, // If the current month is Oct or later (e.g., Q1 of new fiscal year)
        DATE(YEAR(CurrentDate) + 1, 9, 30), // Fiscal year ends Sept 30th of the next calendar year
        DATE(YEAR(CurrentDate), 9, 30) // Fiscal year ends Sept 30th of the current calendar year
    )
VAR Holidays =
    CALCULATETABLE(
        SELECTCOLUMNS(
            'Calendar TB',
            'Calendar TB'[Federal Holiday] // Extracting only the date column
        ),
        'Calendar TB'[IsHoliday] = TRUE // Or 'Calendar TB'[IsHoliday] = 1
    )
RETURN
    NETWORKDAYS(CurrentDate, FiscalYearEnd, 1, Holidays)
 
HearnTexas_1-1753332077377.png

The year starts off on the weekend and it calculates the number of days correctly. When it gets to the Holiday it's subtracting a day and it should be 255 like the weekend, then the 253 should be 254 and so on,

It's doing this for every holiday that follows a weekend or if the holiday is in the middle of the week it skips a number. see below.

In the image below it skipped a number.

HearnTexas_2-1753332526946.png

How can I fix this problem? Your help is greatly appreciated!!

Thank you,

Hearntexas

 
1 ACCEPTED SOLUTION

I solved my own problem with the help of Google. Here is the correct DAX measure. 

Days Left in Fiscal Year =
VAR CurrentDate = 'Calendar TB'[Date]
VAR FiscalYearEnd =
    IF(
        MONTH(CurrentDate) >= 10, // If the current month is Oct or later (e.g., Q1 of new fiscal year)
        DATE(YEAR(CurrentDate) + 1, 9, 30), // Fiscal year ends Sept 30th of the next calendar year
        DATE(YEAR(CurrentDate), 9, 30) // Fiscal year ends Sept 30th of the current calendar year
)
VAR Holidays =
    CALCULATETABLE (
        VALUES ( 'Calendar TB'[Date] ),
        FILTER (
            'Calendar TB',
            'Calendar TB'[IsHoliday] = TRUE() &&
            'Calendar TB'[Date] >= CurrentDate &&
            'Calendar TB'[Date] <= FiscalYearEnd
        )
    )
RETURN
NETWORKDAYS(CurrentDate, FiscalYearEnd, 1, Holidays)
This is what it returns:
HearnTexas_0-1753372649851.png

 

HearnTexas_1-1753372702750.png

 

Thank you again for trying to help me!!

HearnTexas

 

View solution in original post

3 REPLIES 3
bhanu_gautam
Super User
Super User

@HearnTexas , Try using

 

Days Left in Fiscal Year =
VAR CurrentDate = 'Calendar TB'[Date]
VAR FiscalYearEnd =
IF(
MONTH(CurrentDate) >= 10, // If the current month is Oct or later (e.g., Q1 of new fiscal year)
DATE(YEAR(CurrentDate) + 1, 9, 30), // Fiscal year ends Sept 30th of the next calendar year
DATE(YEAR(CurrentDate), 9, 30) // Fiscal year ends Sept 30th of the current calendar year
)
VAR Holidays =
CALCULATETABLE(
SELECTCOLUMNS(
'Calendar TB',
'Calendar TB'[Federal Holiday] // Extracting only the date column
),
'Calendar TB'[IsHoliday] = TRUE // Or 'Calendar TB'[IsHoliday] = 1
)
VAR AdjustedHolidays =
ADDCOLUMNS(
Holidays,
"AdjustedDate",
IF(
WEEKDAY('Calendar TB'[Federal Holiday]) = 1, // If the holiday falls on a Sunday
'Calendar TB'[Federal Holiday] + 1, // Adjust to the following Monday
IF(
WEEKDAY('Calendar TB'[Federal Holiday]) = 7, // If the holiday falls on a Saturday
'Calendar TB'[Federal Holiday] - 1, // Adjust to the previous Friday
'Calendar TB'[Federal Holiday] // Keep the original date
)
)
)
RETURN
NETWORKDAYS(CurrentDate, FiscalYearEnd, 1, AdjustedHolidays)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Thank you for taking the time to help me!!

 

The measure you provided above is not working. I'm receiving and error on "AdjustedDate", see screen shot below.

HearnTexas_0-1753369455922.png

 

I don't think the problem is the holiday falling on a weekend because I've already adjusted that in my Federal Holiday column the date reflects the actual holiday date or the observed date.

 

Thank you again!!

HearnTexas

I solved my own problem with the help of Google. Here is the correct DAX measure. 

Days Left in Fiscal Year =
VAR CurrentDate = 'Calendar TB'[Date]
VAR FiscalYearEnd =
    IF(
        MONTH(CurrentDate) >= 10, // If the current month is Oct or later (e.g., Q1 of new fiscal year)
        DATE(YEAR(CurrentDate) + 1, 9, 30), // Fiscal year ends Sept 30th of the next calendar year
        DATE(YEAR(CurrentDate), 9, 30) // Fiscal year ends Sept 30th of the current calendar year
)
VAR Holidays =
    CALCULATETABLE (
        VALUES ( 'Calendar TB'[Date] ),
        FILTER (
            'Calendar TB',
            'Calendar TB'[IsHoliday] = TRUE() &&
            'Calendar TB'[Date] >= CurrentDate &&
            'Calendar TB'[Date] <= FiscalYearEnd
        )
    )
RETURN
NETWORKDAYS(CurrentDate, FiscalYearEnd, 1, Holidays)
This is what it returns:
HearnTexas_0-1753372649851.png

 

HearnTexas_1-1753372702750.png

 

Thank you again for trying to help me!!

HearnTexas

 

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.