Forum Discussion

kk_shp_user's avatar
kk_shp_user
Helper I
1 year ago
Solved

Computing Rank using 2 measures

I have a data model in which I have created two measures,  m_personal_recruits -> tells how many recruits have been hired by a manager m_personal_recruit_qv -> tells how much sales the new recruits...
  • johnt75's avatar
    johnt75
    1 year ago

    I think the id column is causing the issue. You'll need to add that to the ALLSELECTED, e.g.

    Rank =
    VAR BaseTable =
        ADDCOLUMNS (
            FILTER (
                ADDCOLUMNS (
                    ALLSELECTED ( 'Table'[Manager], 'Table'[id] ),
                    "@PersonalRecruits", [m_personal_recruits]
                ),
                [@PersonalRecruits] > 0
            ),
            "@QV", [m_personal_recruits_qv]
        )
    VAR Result =
        RANK ( BaseTable, ORDERBY ( [@PersonalRecruits], DESC, [@QV], DESC ) )
    RETURN
        Result
    

    You'll also need to add any other columns from the same table which are in the visual.