Forum Discussion
Need Help with RANK function
- 1 year ago
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
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.
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
- v-achippa1 year agoCommunity Support
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
- v-achippa1 year agoCommunity Support
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
- v-achippa1 year agoCommunity Support
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