cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
refint650
Helper I
Helper I

Excel formula if else to power bi

Hello ALL

I'm decoding excel forumula IF Else Datelogic calculation couldnt figure how to re-write in Dax or Mquery Calculation need some help .
F = StartDate
G = RelesaseDate
H = PostedDate
I = AccountDate

ActualDate

IF( ActualDate>=StartDate && RelesaseDate>ActualDate) then "A1"
If( ActualDate>=ReleaseDate && Posteddate>ActualDate) then "A2"
If (ActualDate>=PostedDate && Accountdate>ActualDate) then "A2"
if (Startdate>ActualDate) then ""

 

Thanks

Vs

1 ACCEPTED SOLUTION
selimovd
Super User
Super User

Hey @refint650 ,

 

you can do something like this with the combination of SWITCH with TRUE().

Check the following article on how that works:

https://p3adaptive.com/2015/03/the-diabolical-genius-of-switch-true/

 

And here the example how it would look like:

ActualDate =
SWITCH (
    TRUE (),
    ActualDate >= StartDate && RelesaseDate > ActualDate, "A1",
    ActualDate >= ReleaseDate && Posteddate > ActualDate, "A2",
    ActualDate >= PostedDate && Accountdate > ActualDate, "A2",
    ""
)

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍

Best regards
Denis

Blog: WhatTheFact.bi
Follow me: twitter.com/DenSelimovic

View solution in original post

2 REPLIES 2
refint650
Helper I
Helper I

@selimovd 

 

Let me  rewrite as you said will let you know . Thank you 🙂

selimovd
Super User
Super User

Hey @refint650 ,

 

you can do something like this with the combination of SWITCH with TRUE().

Check the following article on how that works:

https://p3adaptive.com/2015/03/the-diabolical-genius-of-switch-true/

 

And here the example how it would look like:

ActualDate =
SWITCH (
    TRUE (),
    ActualDate >= StartDate && RelesaseDate > ActualDate, "A1",
    ActualDate >= ReleaseDate && Posteddate > ActualDate, "A2",
    ActualDate >= PostedDate && Accountdate > ActualDate, "A2",
    ""
)

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍

Best regards
Denis

Blog: WhatTheFact.bi
Follow me: twitter.com/DenSelimovic

Helpful resources

Announcements
June 2022 update 768X460.jpg

Check it out!

Click here to read more about the June 2022 updates!

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.

Power BI Dev Camp Session 23 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!

June 20 episode 7 with aka link 768x460.jpg

The Power BI Community Show

Join us on June 20 at 11 am PDT when Kim Manis shares the latest on Azure Synapse analytics, the Microsoft Intelligent Data Platform, and notable Power BI Updates from Microsoft Build 2022.

Top Solution Authors