Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Orstenpowers
Post Patron
Post Patron

"Translate" from MS Excel "IF" & "AND" to PBI DAX required

Dear all,

I wrote an Excel formula that works perfectly fine, but now I do need to transfer it to PBI, writing a new measure, but my attempts by using IF, AND and SELECTEDVALUE do not work. ☹️

 

Is anybody out there who could "translate" the following Excel formula?

 

=IF(AND('IObOL new (incl K Group)'[GID (Final Ship to)]= 'IObOL new (incl K Group)'[GID]; 'IObOL new (incl K Group)'[GID (Final Ship to)]= 'IObOL new (incl K Group)'[GID (Final Sold to)];"alle GIDs identisch";

IF('IObOL new (incl K Group)'[GID]= 'IObOL new (incl K Group)'[GID (Final Sold to)];"Order und Sold to identisch";

IF('IObOL new (incl K Group)'[GID (Final Ship to)]= 'IObOL new (incl K Group)'[GID (Sold to)];"Final ship to und Sold to identisch";

IF('IObOL new (incl K Group)'[GID (Final Ship to)]= 'IObOL new (incl K Group)'[GID];"Final ship to und Order identisch";"alle GIDs unterschiedlich"))))

 

I do not get managed. Hopefully one of you can help me.

1 ACCEPTED SOLUTION
DataInsights
Super User
Super User

@Orstenpowers,

 

Try this measure. I wrapped each column reference in MAX (MIN would work too). If you want this to be a calculated column, remove MAX. A calculated column has the advantage of enabling you to filter on the resulting value.

 

Measure =
SWITCH (
    TRUE,
    MAX ( 'IObOL new (incl K Group)'[GID (Final Ship to)] )
        = MAX ( 'IObOL new (incl K Group)'[GID] )
        && MAX ( 'IObOL new (incl K Group)'[GID (Final Ship to)] )
            = MAX ( 'IObOL new (incl K Group)'[GID (Final Sold to)] ), "alle GIDs identisch",
    MAX ( 'IObOL new (incl K Group)'[GID] )
        = MAX ( 'IObOL new (incl K Group)'[GID (Final Sold to)] ), "Order und Sold to identisch",
    MAX ( 'IObOL new (incl K Group)'[GID (Final Ship to)] )
        = MAX ( 'IObOL new (incl K Group)'[GID (Sold to)] ), "Final ship to und Sold to identisch",
    MAX ( 'IObOL new (incl K Group)'[GID (Final Ship to)] )
        = MAX ( 'IObOL new (incl K Group)'[GID] ), "Final ship to und Order identisch",
    "alle GIDs unterschiedlich"
)

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

2 REPLIES 2
DataInsights
Super User
Super User

@Orstenpowers,

 

Try this measure. I wrapped each column reference in MAX (MIN would work too). If you want this to be a calculated column, remove MAX. A calculated column has the advantage of enabling you to filter on the resulting value.

 

Measure =
SWITCH (
    TRUE,
    MAX ( 'IObOL new (incl K Group)'[GID (Final Ship to)] )
        = MAX ( 'IObOL new (incl K Group)'[GID] )
        && MAX ( 'IObOL new (incl K Group)'[GID (Final Ship to)] )
            = MAX ( 'IObOL new (incl K Group)'[GID (Final Sold to)] ), "alle GIDs identisch",
    MAX ( 'IObOL new (incl K Group)'[GID] )
        = MAX ( 'IObOL new (incl K Group)'[GID (Final Sold to)] ), "Order und Sold to identisch",
    MAX ( 'IObOL new (incl K Group)'[GID (Final Ship to)] )
        = MAX ( 'IObOL new (incl K Group)'[GID (Sold to)] ), "Final ship to und Sold to identisch",
    MAX ( 'IObOL new (incl K Group)'[GID (Final Ship to)] )
        = MAX ( 'IObOL new (incl K Group)'[GID] ), "Final ship to und Order identisch",
    "alle GIDs unterschiedlich"
)

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




@DataInsights : Thank you so much! It works absolutely fine. 👍

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.