Forum Discussion

Charles-C's avatar
Charles-C
Regular Visitor
3 years ago
Solved

Use a calculated measure with a condition

Hi,   I need some help and guidance please.   I have the below table with an Employee, Manager, and sales. For every manager there is a Supervisor and as you will see there is $0 sales for each o...
  • v-yueyunzh-msft's avatar
    3 years ago

    Hi , Charles-C 

    According to your description, you want to calculate the "Supervisor" sales.

    Here are the steps you can refer to :
    (1)If you want to show in the measure , you just need to put the fields on the visual. And you can use this measure to show the Supervisor Name:

    Manager Name = CALCULATE( MAX('Table'[Employee]) , 'Table'[Role]="Supervisor")

    (2)If you want to create a calcualted column in your table , you can use this dax code:

    Column = var _cur_manager =[Manager]
    var _sum = SUMX(FILTER('Table','Table'[Manager] = _cur_manager) , [Sales])
    return
    IF([Role]="Supervisor"  ,_sum ,[Sales])

     

    Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

     

    Best Regards,

    Aniya Zhang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly