cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
LewisH Regular Visitor
Regular Visitor

Calculating days between dates and ignore if blank

I have two dates in a table, Registering Day and Day out. 

 

There will always be a registering date, but not always a day out. I need to work out the average daby between but this is casuing errors beciase one of the days will be blank. I have started with something like this but can anyone guide me on how to correct it. Thanks

 

Workingdays = CALCULATE(SUM('DateKey'[IsWorkingDay]), DATESBETWEEN(DateKey[Date],'Put Away Headers'[Registering_Date],'Put Away Headers'[Day_Out])) -- Here i need to filter out blank "Day Out"

2 ACCEPTED SOLUTIONS

Accepted Solutions
v-ljerr-msft Super Contributor
Super Contributor

Re: Calculating days between dates and ignore if blank

Hi @LewisH,

 

If I understand you correctly, the formula below should work in your scenario. Smiley Happy

Workingdays =
IF (
    ISBLANK ( 'Put Away Headers'[Day_Out] ),
    BLANK (),
    CALCULATE (
        SUM ( 'DateKey'[IsWorkingDay] ),
        DATESBETWEEN (
            DateKey[Date],
            'Put Away Headers'[Registering_Date],
            'Put Away Headers'[Day_Out]
        )
    )
)

 

Regards

View solution in original post

Super User
Super User

Re: Calculating days between dates and ignore if blank

Hi,

 

Does this work?

 

=CALCULATE(SUM('DateKey'[IsWorkingDay]),FILTER('Put Away Headers','Put Away Headers'[Day_out]<>BLANK()),DATESBETWEEN(DateKey[Date],'Put Away Headers'[Registering_Date],'Put Away Headers'[Day_Out]))

View solution in original post

2 REPLIES 2
v-ljerr-msft Super Contributor
Super Contributor

Re: Calculating days between dates and ignore if blank

Hi @LewisH,

 

If I understand you correctly, the formula below should work in your scenario. Smiley Happy

Workingdays =
IF (
    ISBLANK ( 'Put Away Headers'[Day_Out] ),
    BLANK (),
    CALCULATE (
        SUM ( 'DateKey'[IsWorkingDay] ),
        DATESBETWEEN (
            DateKey[Date],
            'Put Away Headers'[Registering_Date],
            'Put Away Headers'[Day_Out]
        )
    )
)

 

Regards

View solution in original post

Super User
Super User

Re: Calculating days between dates and ignore if blank

Hi,

 

Does this work?

 

=CALCULATE(SUM('DateKey'[IsWorkingDay]),FILTER('Put Away Headers','Put Away Headers'[Day_out]<>BLANK()),DATESBETWEEN(DateKey[Date],'Put Away Headers'[Registering_Date],'Put Away Headers'[Day_Out]))

View solution in original post

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 55 members 1,215 guests
Please welcome our newest community members: