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

DAX to replace multiple IF statements in Excel

Hi all

 

could someone kindly propose a suitable DAX alternative (for PBI) to the below formula in Excel ?

 

=IF([@CompleteBy] = "", "NA",IF([@CompletedDate] >[@CompleteBy],"Overdue", IF(AND([@CompleteBy] < TODAY(),[@CompletedDate] =""),"Overdue","Not Overdue")))

 

 

tbl.PNG

 

Thanks in advance

1 ACCEPTED SOLUTION

Hi @Anonymous ,

You can create a calculated column as below:

Overdue = 
IF (
    ISBLANK ( 'Table'[CompleteBy] )
        && 'Table'[Status] <> "Overdue",
    BLANK (),
    IF (
        'Table'[CompletedDate] > 'Table'[CompleteBy],
        "Overdue",
        IF (
            'Table'[CompleteBy] < TODAY ()
                && ISBLANK ( 'Table'[CompletedDate] ),
            "Overdue",
            "Not Overdue"
        )
    )
)

yingyinr_0-1616397733250.png

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous , Create a new column like

 

if(isblank([CompletedDate]) && [CompleteBy] <today(), "Overdue","Not Overdue")

Anonymous
Not applicable

Thanks but not quite working yet...


Overdue = IF(Table 1[Status] = "Overdue", "Overdue", IF(ISBLANK(Table 1[CompletedDate] && Table 1[CompleteBy].[Date] < TODAY()),"Overdue","Not Overdue"))

 

Where i have a Completeby date in the past, it is still showing as "Not Overdue"... any ideas?

 

thanks

Hi @Anonymous ,

You can create a calculated column as below:

Overdue = 
IF (
    ISBLANK ( 'Table'[CompleteBy] )
        && 'Table'[Status] <> "Overdue",
    BLANK (),
    IF (
        'Table'[CompletedDate] > 'Table'[CompleteBy],
        "Overdue",
        IF (
            'Table'[CompleteBy] < TODAY ()
                && ISBLANK ( 'Table'[CompletedDate] ),
            "Overdue",
            "Not Overdue"
        )
    )
)

yingyinr_0-1616397733250.png

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.