Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Multiple IF Conditions or OR Function or IN Function

Fabricmates,   I am trying to create a new column which has to drive value after validating 2 different column conditions.   Below is three attributes (Column)   Count         Score     Dollar ...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Anonymous ,

    Please try to create a new column with below dax formula:

    New Dollar =
    VAR cur_count = [Count]
    VAR cur_score = [Score]
    VAR cur_dollar = [Dollar(Mn)]
    VAR tmp = { "10 CT", "18 CT", "28 CT" }
    VAR _r1 = ( 80 - cur_score ) * cur_dollar
    VAR _r2 = ( 75 - cur_score ) * cur_dollar
    RETURN
        SWITCH (
            TRUE (),
            cur_count
                IN tmp
                    && cur_score >= 80, _r1,
            cur_count = "40 CT"
                && cur_score >= 75, _r2
        )
    

    Please refer the attached .pbix file.

     

    Best regards,
    Community Support Team_Binbin Yu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.