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
v_mark
Helper V
Helper V

Treat 1900 as blank in M and calculate the difference in Minutes

I was trying to do this type of DAX in Power Query but no luck. 
Not sure if there is a way to achieve this in M. Please help.

 

Duration in Mins =
IF (
'Incident'[Stat_RepairStart] = DATE ( 1900, 1, 1 ),
BLANK (),
DATEDIFF ( 'Incident'[Stat_Diagnosis], 'Incident'[Stat_RepairStart], MINUTE )
)
 
 
 
1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

In M, you could write this as a custom column similar to this:

 

if [Stat_RepairStart] = #datetime(1900,1,1,0,0,0) then null
else Duration.TotalMinutes([Stat_RepairStart] - [Stat_Diagnosis])

View solution in original post

4 REPLIES 4
AlexisOlson
Super User
Super User

In M, you could write this as a custom column similar to this:

 

if [Stat_RepairStart] = #datetime(1900,1,1,0,0,0) then null
else Duration.TotalMinutes([Stat_RepairStart] - [Stat_Diagnosis])

Looks like after then the null is causing an error. 

 

v_mark_0-1622835835306.png

 

It's case-sensitive so you can't use If instead of if

Holy cow. Didn't see that clearly. My bad. Thanks for the help! It is working 

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