Forum Discussion

k_mathana's avatar
k_mathana
Icon for Helper II rankHelper II
4 years ago
Solved

RANK on Multiple Measures with different Order

Hi there,

I have a scenario that each month contractors Quoting with more than 4 options with different criteria's, some criterias values are higher the better, some criterias value are lower the better. All the Criterias are calculated as a "Measure". So I need to Rank all the multiple measures together, considering ranking order, and for each month. Could you please kindly help to formulate this?, it will be very help ful. 

 

MonthNameOptionCriteria 1
%
(Higher the better)
Criteria 2
Number
(Higher the better)
Criteria 3
%
(Lower the better)
Criteria 4
Number
(Lower the better)
Jan.21Contractor 1Option 190%690%6
Jan.21Contractor 1Option 292%792%7
Jan.21Contractor 1Option 393%6.593%6.5
Jan.21Contractor 1Option 487%787%7
Jan.21Contractor 2Option 187%7.587%7.5
Jan.21Contractor 2Option 286%886%8
Jan.21Contractor 2Option 397%897%8
Jan.21Contractor 2Option 495%8.595%8.5
Jan.21Contractor 3Option 175%975%9
Jan.21Contractor 3Option 298%9.598%9.5
Jan.21Contractor 3Option 397%797%7
Jan.21Contractor 3Option 493%693%6
Feb.21Contractor 1Option 190%690%6
Feb.21Contractor 1Option 292%792%7
Feb.21Contractor 1Option 393%6.593%6.5
Feb.21Contractor 1Option 487%787%7
Feb.21Contractor 2Option 187%7.587%7.5
Feb.21Contractor 2Option 286%886%8
Feb.21Contractor 2Option 397%897%8
Feb.21Contractor 2Option 495%8.595%8.5
Feb.21Contractor 3Option 175%975%9
Feb.21Contractor 3Option 298%9.598%9.5
Feb.21Contractor 3Option 397%797%7
Feb.21Contractor 3Option 493%693%6
  • Hi,

    this is what i get

    using this 2 measures (RankTotal is not necessary but helps to understand)

    RankTotal by Month =
    var currentmonth = filter('Table',month('Table'[Date]))
    var Rank1 = RANKX(currentmonth,'Table'[Criteria 1],,ASC)
    var Rank2 = RANKX(currentmonth,'Table'[Criteria 2],,ASC)
    var Rank3 = RANKX(currentmonth,'Table'[Criteria 3],,DESC)
    var Rank4 = RANKX(currentmonth,'Table'[Criteria 4],,desc)
    Var RankTotal = Rank1+Rank2+Rank3+Rank4
    return
    RankTotal
     
     
    RankGlobal by Month =
    var currentmonth = filter('Table',month('Table'[Date]))
    var Rank1 = RANKX(currentmonth,'Table'[Criteria 1],,ASC)
    var Rank2 = RANKX(currentmonth,'Table'[Criteria 2],,ASC)
    var Rank3 = RANKX(currentmonth,'Table'[Criteria 3],,DESC)
    var Rank4 = RANKX(currentmonth,'Table'[Criteria 4],,desc)
    Var RankTotal = Rank1+Rank2+Rank3+Rank4
    var RankGlobal = RANKX(currentmonth,'Table'[RankTotal by Month],,Desc,Dense)
    return
    RankGlobal
     

    If this post is useful to help you to solve your issue consider giving the post a thumbs up 

     and accepting it as a solution !

7 Replies

  • Hi, 

    it's not clear to me why there are 4 records for each option on the same contractor as appears in your sample data.

    Nevertheless i think that a calculeted column like this might solve your problem and obtain something like this:

    This is the calculated column

     

    RankTotal =

    var Rank1 = RANKX('Table','Table'[Criteria 1],,DESC)
    var Rank2 = RANKX('Table','Table'[Criteria 2],,Desc)
    var Rank3 = RANKX('Table','Table'[Criteria 3],,ASC)
    var Rank4 = RANKX('Table','Table'[Criteria 4],,ASC)
    Var RankTotal = Rank1+Rank2+Rank3+Rank4
    return
    RankTotal
     
    You can also weight your criteria by multiplying for a fixed coefficient or maybe for a parameter if you need to change it frequently.
     
    If this post is useful to help you to solve your issue consider giving the post a thumbs up 👍 and accepting it as a solution !
     
    • k_mathana's avatar
      k_mathana
      Icon for Helper II rankHelper II

      Hi serpiva64,

      Thanks for given solution, but I need to rank within each month. so each month best contractot with best option will be choosen!

      • serpiva64's avatar
        serpiva64
        Icon for Solution Sage rankSolution Sage

        Sorry, 

        in your exemple there is only 1 contractor.

        Can you specify your sample data? 

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi k_mathana ,

     

    If you need group ranking, you can refer to the following measure.

    measure = rankx(filter(allselected('table'),[Month] = selectedvalue([Month])),[Criteria ],,desc)

    In your case, you have four Criterias. You will need to set the proportion for each Criteria. Otherwise it could return same rank if we just sum the rank values.

     

    Best Regards,

    Jay