Forum Discussion

Oros's avatar
Oros
Post Prodigy
1 year ago
Solved

Filtered measure

Hello,   I have the following table. What would be the correct measure to use so that if a year and salesperson is selected, the specific salesperson's sales (for the selected year) will be calcula...
  • Irwan's avatar
    1 year ago

    hello Oros 

     

    please check if this accomodate your need.

     

    create a new measure with following DAX.

    Measure = 
    var _Salesperson = SELECTEDVALUE('Table'[SALESPERSON])
    var _Year = SELECTEDVALUE('Table'[Year])
    Return
    DIVIDE(
        CALCULATE(SUM('Table'[Sales]),FILTER(ALLSELECTED('Table'),'Table'[SALESPERSON]=_Salesperson&&'Table'[Year]=_Year)),
        CALCULATE(SUM('Table'[Sales]),FILTER(ALL('Table'),'Table'[SALESPERSON]=_Salesperson))
    )
     

    Hope this will help.

    Thank you.