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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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