Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

New Conditional Column Calculation based on (non-value) other column entry

Hi, I'm relatively new to PBI and I wanted to create a column showing the 'Bonus' amount (the new 'outcome' column) but based on a calculation of either ("Sales Rev" x "Multiplier") or ("Sales+Referr...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Anonymous ,

    Based on the calculation logic provided in your screenshot (Columns J and K), it seems that the calculation logic you describe and the calculation results do not match. If the values in column J are correct, then the calculation logic should be as follows:
    If Level = "Junior", then it is (Sales Rev1+Sales Rev2+Sales Rev3)*2;
    If Level = "Exec", then it is (Sales Rev1+Sales Rev2+Sales Rev3+Sales Rev4)*3;
    If it is other level, it is 0.
    If my understanding above is correct, you can create the following calculated column or measure to get the Bonus... Please find the details in the attachment.

    Calculated column:

    Bonus = 
    VAR _srev = 'Table'[Sales Rev1] + 'Table'[Sales Rev2] + 'Table'[Sales Rev3]
    VAR _srefrev = 'Table'[Sales Rev1] + 'Table'[Sales Rev2] + 'Table'[Sales Rev3] + 'Table'[Sales Rev4]
    RETURN
        SWITCH ( 'Table'[Level], "Junior", _srev * 2, "Exec", _srefrev * 3, 0 )

    Measure:

    Measure_Bonus = 
    VAR _srev =
        SUM ( 'Table'[Sales Rev1] ) + SUM ( 'Table'[Sales Rev2] )
            + SUM ( 'Table'[Sales Rev3] )
    VAR _srefrev =
        SUM ( 'Table'[Sales Rev1] ) + SUM ( 'Table'[Sales Rev2] )
            + SUM ( 'Table'[Sales Rev3] )
            + SUM ( 'Table'[Sales Rev4] )
    RETURN
        SWITCH (
            SELECTEDVALUE ( 'Table'[Level] ),
            "Junior", _srev * 2,
            "Exec", _srefrev * 3,
            0
        )

    Best Regards