Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
yforti13
Regular Visitor

Need Help with RANK function

Good afternoon!

I need help adjusting my RANK measurement.

Currently it repeats the value 15 for all other values ​​that repeat with the same value, this is making it difficult for me to make the top 20.

Any ideas?


My meaure =

m_RankingTabelaRec1820 =

RANK(
    DENSE,
        ALLSELECTED( d_DemaisConvenios[Convênio] ),
    ORDERBY(
        CALCULATE(
            [m_Recuperacao],
            d_Calendario[Date] >= DATE(2025, 02, 01),
            d_Calendario[Date] <= DATE(2025, 02, 29)),
            DESC
   
)
)

 

Point of attention: I am ranking by values ​​from the month of February.

 

yforti13_0-1744902372425.png

 

1 ACCEPTED SOLUTION

Hi @yforti13,

 

Thank you for reaching out to Microsoft Fabric Community.

 

To exclude values that are zero and only assign ranks to values greater than zero, here is an updated measure that will rank only values greater than 0, and show no rank (blank) for zero values:

 

m_RankingTabelaRec1820 =
VAR CurrentValue =
CALCULATE(
[m_Recuperacao],
d_Calendario[Date] >= DATE(2025, 2, 1),
d_Calendario[Date] <= DATE(2025, 2, 29)
)
RETURN
IF (
CurrentValue > 0,
RANK(
DENSE,
FILTER(
ALLSELECTED(d_DemaisConvenios[Convênio]),
CALCULATE(
[m_Recuperacao],
d_Calendario[Date] >= DATE(2025, 2, 1)
&& d_Calendario[Date] <= DATE(2025, 2, 29)
) > 0
),
ORDERBY(
CALCULATE(
[m_Recuperacao],
d_Calendario[Date] >= DATE(2025, 2, 1)
&& d_Calendario[Date] <= DATE(2025, 2, 29)
),
DESC
)
)
)

 

 

If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it! 

 

Thanks and regards,

Anjan Kumar Chippa

View solution in original post

6 REPLIES 6
Greg_Deckler
Community Champion
Community Champion

@yforti13 Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

the problem is that my ranking measure is applying the fifteenth place equally to all zero values, I would like it to only apply the ranking to values ​​that are above zero and not include any ranking for any zero value.

 

 

yforti13_0-1744905574495.png

 

Hi @yforti13,

 

Thank you for reaching out to Microsoft Fabric Community.

 

To exclude values that are zero and only assign ranks to values greater than zero, here is an updated measure that will rank only values greater than 0, and show no rank (blank) for zero values:

 

m_RankingTabelaRec1820 =
VAR CurrentValue =
CALCULATE(
[m_Recuperacao],
d_Calendario[Date] >= DATE(2025, 2, 1),
d_Calendario[Date] <= DATE(2025, 2, 29)
)
RETURN
IF (
CurrentValue > 0,
RANK(
DENSE,
FILTER(
ALLSELECTED(d_DemaisConvenios[Convênio]),
CALCULATE(
[m_Recuperacao],
d_Calendario[Date] >= DATE(2025, 2, 1)
&& d_Calendario[Date] <= DATE(2025, 2, 29)
) > 0
),
ORDERBY(
CALCULATE(
[m_Recuperacao],
d_Calendario[Date] >= DATE(2025, 2, 1)
&& d_Calendario[Date] <= DATE(2025, 2, 29)
),
DESC
)
)
)

 

 

If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it! 

 

Thanks and regards,

Anjan Kumar Chippa

Hi @yforti13,

 

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution I have provided for the issue worked? or let us know if you need any further assistance.
If my response addressed, please mark it as "Accept as solution" and click "Yes" if you found it helpful.

 

Thanks and regards,

Anjan Kumar Chippa

Hi @yforti13,

 

We wanted to kindly follow up to check if the solution I have provided for the issue worked.
If my response addressed, please mark it as "Accept as solution" and click "Yes" if you found it helpful.

 

Thanks and regards,

Anjan Kumar Chippa

Hi @yforti13,

 

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution I have provided for the issue worked.
If my response addressed, please mark it as "Accept as solution" and click "Yes" if you found it helpful.

 

Thanks and regards,

Anjan Kumar Chippa

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.