Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

IF or SWITCH statement depending on the selected value of another column

Hi,   I need a measure that will evaluate a column named "Company" and return a specific currency in the "Currency" column based on the "Company" selection. So in my "Company" column, I have Compan...
  • v-jingzhang's avatar
    5 years ago

    Hi Anonymous 

     

    SELECTEDVALUE(Append2[Currency]) ="BRL" is a logical condition statement, so it will always return a logical result True/False.

     

    In your scenario, if your table structure is like below ("BRL" and "USD" are both in the Currency column), you could create a measure to calculate the value you need to populate the column chart. For example,

    Amount measure = 
    IF (
        SELECTEDVALUE ( 'Table (3)'[Company] ) IN { "Company A", "Company B" },
        CALCULATE ( SUM ( 'Table (3)'[Amount] ), 'Table (3)'[Currency] = "BRL" ),
        SUM ( 'Table (3)'[Amount] )
    )
    

     

    You could modify the measure per your need.

     

    Regards,
    Community Support Team _ Jing
    If this post helps, please Accept it as the solution to help other members find it.