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
mikaelim
New Member

DATEDIFF with blanks and nulls

Hello, 

 

I have to calculate the difference in number of days between two columns. The problem I am having with Date Diff is that the second column includes 'N/A's and blanks. Here's the details. It's dates a call was placed and returned. 

If the second column has the SAME DATE as the first, that means call was returned same day and the difference would be 0. If the second column has an N/A, that measn the call was answered in real time and these must be treated separately as they should not get mixed with same day return calls. If the second column has a blank, that means the call was never returned. 

 

How do I handle both Blanks in NAs in the formatting?

How do I modify the fx DateDiff to ignore the Blanks and NAs?

1 REPLY 1
lbendlin
Super User
Super User

You're on the right track. First you need to define clear business rules for each scenario (N/A and <blank>  are separate scenarios!) and then you modify your DAX accordingly.  Use SWITCH() and COALESCE() - they are your friend.

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.

Top Solution Authors