cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MrMED87
Frequent Visitor

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
yingyinr
Community Support
Community Support

Hi @MrMED87 ,

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

@MrMED87 , Create a new column like

 

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



Power BI Features || Datamarts: https://youtu.be/8tskWsJTEpg || Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Time Intelligence Decoded : https://youtu.be/aU2aKbnHuWs&t=145s
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Dashboard of My Blogs !! Connect on Linkedin !! Subscribe to my youtube Channel !!
Want To Learn Power BI | Beginners !! Advance Concepts !! Power BI For Tableau User !!

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

yingyinr
Community Support
Community Support

Hi @MrMED87 ,

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
August 1 episode 9_no_dates 768x460.jpg

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power BI Dev Camp Session 24 without aka link and time 768x460.jpg

Ted's Dev Camp - July 28, 2022

Watch Session 24 of Ted's Dev Camp along with past sessions!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Top Solution Authors
Top Kudoed Authors