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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Tyler99
New Member

How to include IF Start date / End date is blank then ignore

Hi,

 

I am a beginner in Power BI and I am trying to get the number of day from start date/end date. 

Its proving a challenge as I needed it to be work days mon-fri.

 

Below is the DAX used for my column but its providing me with an error - The start date or end date in Calendar function can not be Blank value.

 

I am assuming this is because some of the rows start date or end date, may be blank. However I want to to ignore them and just give me the days for the ones with a start and end date.

 

I have tried putting in an IF statement but it did not seem to work as I really have no clue where to input it.

 

Weekdays = COUNTROWS(
    FILTER(
        ADDCOLUMNS(
            CALENDAR('IT - Projects/Resource Tracker'[Start Date],
            'IT - Projects/Resource Tracker'[End Date]),
            "Day of Week",
            WEEKDAY([Date], 2) ),
            [Day of Week] <> 6 &&
            [Day of Week] <> 7 ))
 
Would really appricate the help.
 
Thanks 
1 ACCEPTED SOLUTION
AilleryO
Memorable Member
Memorable Member

Hi,

 

Why not using the NETWORKDAYS function in DAX, especially if you just need to remove satudays and sundays.

If you have to deal with bank holidays then you'd better set them in a Date Table.

You can even set some bank holidays in NETWORKDAYS but it might be more easy with a date table.

 

So if you just need to remove saturdays and sundays, networkdays(startdate, enddate) is perfect.

If you want more details about the funtion :

https://learn.microsoft.com/en-us/dax/networkdays-dax

 

Let us know if it works or if you need more information

View solution in original post

1 REPLY 1
AilleryO
Memorable Member
Memorable Member

Hi,

 

Why not using the NETWORKDAYS function in DAX, especially if you just need to remove satudays and sundays.

If you have to deal with bank holidays then you'd better set them in a Date Table.

You can even set some bank holidays in NETWORKDAYS but it might be more easy with a date table.

 

So if you just need to remove saturdays and sundays, networkdays(startdate, enddate) is perfect.

If you want more details about the funtion :

https://learn.microsoft.com/en-us/dax/networkdays-dax

 

Let us know if it works or if you need more information

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.