Forum Discussion

PowerBINoob24's avatar
PowerBINoob24
Icon for Resolver I rankResolver I
4 years ago
Solved

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.
  • Approval Metric = IF(ISBLANK([Approved Date].[Date]), "Being Performed", IF(([Approved Date].[Date]>[Due Date].[Date],"Late","On Time"))

6 Replies

  • rsbin's avatar
    rsbin
    Icon for Community Champion rankCommunity Champion

    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,

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

    • PowerBINoob24's avatar
      PowerBINoob24
      Icon for Resolver I rankResolver I

      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"))

      • JorgePinho's avatar
        JorgePinho
        Icon for Solution Sage rankSolution Sage

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