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
Anonymous
Not applicable

Help with Calculated Column Nested IF Statements

I have an IF statement that is partially correct... 

 

Here is the current function: 

Expired in Middle = IF(ERT_CHANGE_LOG[USERNAME] = "system", -1, (([TIME_OF_EVENT]-[PREV_ERT])*1440))
 
But, there is a caveat to it. Sometimes the [PREV_ERT] column contains blanks, and if that column is blank, I want the statement to then to look at the [ERT] column and do the function: [TIME_OF_EVENT]-[ERT])*1440
 
Any help with the syntax would be greatly appreciated!

I have attached a picture of the table in the data view below: 

CollinSharp1_1-1637246564362.png

 

 

1 ACCEPTED SOLUTION
jppv20
Solution Sage
Solution Sage

Hi @Anonymous ,

 

This should work:

Expired in Middle = 
IF(ERT_CHANGE_LOG[USERNAME] = "system", -1,
IF([PREV_ERT]=BLANK(),([TIME_OF_EVENT]-[ERT])*1440,
(
[TIME_OF_EVENT]-[PREV_ERT])*1440))

 

If I answered your question, please mark it as a solution to help other members find it more quickly.

View solution in original post

6 REPLIES 6
jppv20
Solution Sage
Solution Sage

Hi @Anonymous ,

 

This should work:

Expired in Middle = 
IF(ERT_CHANGE_LOG[USERNAME] = "system", -1,
IF([PREV_ERT]=BLANK(),([TIME_OF_EVENT]-[ERT])*1440,
(
[TIME_OF_EVENT]-[PREV_ERT])*1440))

 

If I answered your question, please mark it as a solution to help other members find it more quickly.

Anonymous
Not applicable

Yeah that is exactly what I need. Thanks!

smpa01
Super User
Super User

@Anonymous  can you please post some sample data

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
Anonymous
Not applicable

Here is a picture of sample data: 

CollinSharp1_0-1637247886975.png



smpa01
Super User
Super User

@Anonymous 

IF(ERT_CHANGE_LOG[USERNAME] = "system", -1, (([TIME_OF_EVENT]-IF([PREV_ERT]=BLANK(),[ERT],[PREV_ERT])*1440)))
Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
Anonymous
Not applicable

I think that is close but not quite it. It was giving me some crazy values when I input that function in.

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.