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
PowerBINoob24
Resolver I
Resolver I

Third Result Option Based on a Date Calculation

Hello all:
 
I have the following calculated column in my PoerBI report:
Approval Metric = IF([Approved Date].[Date]>[Due Date].[Date],"Late","On Time")
 
It works great; however, in some instances there may not be an approved date because the work is still being performed.  Is there any way to add a third option of "In Progress" for those rows taht do not have an approval date yet?
 
Thanks in advance for helping me with my severe lack of PowerBI knowledge.
1 ACCEPTED SOLUTION
JorgePinho
Solution Sage
Solution Sage

Approval Metric = IF(ISBLANK([Approved Date].[Date]), "Being Performed", IF(([Approved Date].[Date]>[Due Date].[Date],"Late","On Time"))

View solution in original post

6 REPLIES 6
rsbin
Super User
Super User

@PowerBINoob24 ,

The SWITCH function in DAX is very similar to using a nested IF function.  Please try something like this:

ApprovalMetric = SWITCH(
                    TRUE(),
                    [Approved Date] = Blank(),"In Progress",
                    [Approved Date] > [Date], "Late",
                    "On Time" )

Hope you can get this to work for you.

Regards,

JorgePinho
Solution Sage
Solution Sage

Approval Metric = IF(ISBLANK([Approved Date].[Date]), "Being Performed", IF(([Approved Date].[Date]>[Due Date].[Date],"Late","On Time"))

This worked like a charm, although you did have an extra parenthesis in your formula.

Approval Metric = IF(ISBLANK([Approved Date].[Date]), "Being Performed", IF(([Approved Date].[Date]>[Due Date].[Date],"Late","On Time"))

I'm glad it worked. The other solution by @rsbin would also work 🙂
And I'm sorry for the extra parenthesis!

@JorgePinho , @PowerBINoob24 ,

Hence why I have learned to use the SWITCH.  Alleviates the issue with all of those parenthesis.😁

 

You're right! And it also looks a lot cleaner and easier to read and understand 😀

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.