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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Ponyglyph
New Member

Calculate amount of days between 2 dates (excluding day off)

Hi everyone,

 

I'm facing an issue with Power BI, I would like to calculate the amount of days between 2 dates.

I can't use networkdays because I need a decimal number (I will convert it to Days/hours)
I need to calculate how long a case is open

 

So in my dim_date, I added the following calculated column:

 

Is_workday= IF(OR(DIM_Date[WeekDay] =6,DIM_Date[WeekDay] = 7),0,1)
 
And in my case table, I add the following column:
_Workdays =
    CALCULATE (
        SUM ( 'Calendar'[Is_workday] ),
        ALL ( 'Calendar' ),
        DATESBETWEEN ( 'Calendar'[Date], case[createdDate], case[closingDate])
 
but my column return blank value all the time...
Any idea of what I could do to solve this issue?
 
Many thanks for your help
    )

 

2 REPLIES 2
Ponyglyph
New Member

Networkdays returns whole number, and I woul like to get the time in hour
For example, if it returns 1.25, it means 30h 

amitchandak
Super User
Super User

@Ponyglyph , You can use networkdays, you can also supply a holiday list to this function

 

Power BI - Business day with and without using DAX Function NETWORKDAYS: https://www.youtube.com/watch?v=Qs03ZZXXE_c
https://medium.com/@amitchandak/power-bi-dax-function-networkdays-5c8e4aca38c

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.