Forum Discussion

tonymaclaren's avatar
tonymaclaren
Helper I
8 years ago
Solved

highest value by category

Hi I am strugling with a problem as follows: I need a DAX measure to find the percentage that matches the highest year value for a given category. So Category A would equal 9 % and Category B would...
  • Zubair_Muhammad's avatar
    Zubair_Muhammad
    8 years ago

    tonymaclaren

     

    As a MEASURE.....

     

    Max Percentage measure =
    VAR MaxYear =
        CALCULATE (
            MAX ( 'User Table'[Year] ),
            ALLEXCEPT ( 'User Table', 'User Table'[Category] )
        )
    RETURN
        CALCULATE (
            MAX ( 'User Table'[Percentage] ),
            FILTER (
                ALLEXCEPT ( 'User Table', 'User Table'[Category] ),
                'User Table'[Year] = MaxYear
            )
        )