Forum Discussion

yforti13's avatar
yforti13
Regular Visitor
1 year ago
Solved

HELP dax rankx

Hi guys!

 

I'm trying to sort the top 20 values ​​in my table, but I'm encountering the following scenario:

My measure:

 

 


As you can see below, there are values ​​for past months, but I wanted to sort the values ​​for the current month (February):

 

Can someone help me?


 

  • yforti13's avatar
    yforti13
    1 year ago

    i didn't understand 😕

    Like this?

    RankingTableCNE180d =

    VAR _x =
    RANKX(
        ALL(d_DemaisConvenios),
    CALCULATE(
    [m_CNE180],
    'd_Calendario'[Date] >= DATE(2025, 02, 01),
    'd_Calendario'[Date] <= DATE(2025, 02, 29)
    ))

    RETURN
    _x

6 Replies

  • Hello yforti13 ,

     

    You can try this measure

     

    RankingTableCNE180d =
    VAR _x =
    RANKX(
    ...
    CALCULATE(
    [r_CNE180d],
    'd_Calendario'[Date] >= DATE(2025, 02, 01),
    'd_Calendario'[Date] <= DATE(2025, 02, 29)
    )
    )
    ...
    RETURN
    SWITCH(TRUE()

     

     

     

    Thanks,
     Pankaj Namekar | LinkedIn

    If this solution helps, please accept it and give a kudos (Like), it would be greatly appreciated.

    • yforti13's avatar
      yforti13
      Regular Visitor

      i didn't understand 😕

      Like this?

      RankingTableCNE180d =

      VAR _x =
      RANKX(
          ALL(d_DemaisConvenios),
      CALCULATE(
      [m_CNE180],
      'd_Calendario'[Date] >= DATE(2025, 02, 01),
      'd_Calendario'[Date] <= DATE(2025, 02, 29)
      ))

      RETURN
      _x
  • v-sdhruv's avatar
    v-sdhruv
    Icon for Community Support rankCommunity Support

    Hi yforti13 ,
    I hope this information was helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.
    Thank you.

  • v-sdhruv's avatar
    v-sdhruv
    Icon for Community Support rankCommunity Support

    Hi @yforti13 ,
    I hope this information was helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.
    Thank you.

  • v-sdhruv's avatar
    v-sdhruv
    Icon for Community Support rankCommunity Support

    Hi @yforti13 ,
    I hope this information was helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.
    Thank you.