Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Rank with three conditions

Hi All,    I have spent hours on this and yet to find a result that works, I need to be able to dynamically rank based on three conditions: Conditon 1 = Level Condition 2 = Semester / Term Condi...
  • TomMartens's avatar
    TomMartens
    6 years ago

    Hey Keelin,

     

    this is the measure:

    ms Rank = 
    var NoOfResponsesThreshold = SELECTEDVALUE(Slicer[Disconnected Responses Slicer] , 10) 
    return
    IF(AND(HASONEVALUE('Fact'[Record]) , AND(HASONEVALUE('Fact'[Level]) , HASONEVALUE('Fact'[Semester / Term])))
        ,IF(CALCULATE(SUM('Fact'[Responses])) >= NoOfResponsesThreshold
            ,RANKX(
                FILTER(
                    CALCULATETABLE(
                        ADDCOLUMNS(
                            SUMMARIZE(
                                'Fact', 'Fact'[Semester / Term] , 'Fact'[Level] , 'Fact'[Record]
                            )
                            , "NoOfResponses" , CALCULATE(SUM('Fact'[Responses]))
                        )           
                        , ALLEXCEPT('Fact' , 'Fact'[Semester / Term] , 'Fact'[Level])
                    )
                , [NoOfResponses] >= NoOfResponsesThreshold
                )
                ,CALCULATE(SUM('Fact'[Result]))
                ,,DESC,Skip
            )
            , BLANK()
        )
    )

    that allows to create this matrix visual

    Change the parameter from Skip to Dense if you like to see a 2 instead of a 3.

     

    Regards,

    Tom