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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Rfranca
Resolver IV
Resolver IV

Ranking TOP N sales without zeros

 

I'm doing the sales rank, but when I set up the table for presentation the products that had sales with zero appear in the rank table, how do I mount the rank without the products with sales with zero.

 

Clipboard01.gif

 

1 ACCEPTED SOLUTION

Hi @Rfranca,

 

Try this measure in the Mx_sales table

 

=RANKX(FILTER(All('PRODUCT'[ProductName]),[Ttotal_Sales]>0),[Ttotal_Sales],,ASC,Skip)

 

In the Visual level filters, apply a criteria on the Ttoal_Sales of >0

 

Hope this helps.

 

Untitled.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

7 REPLIES 7
ccakjcrx
Resolver I
Resolver I

Hey @Rfranca!

 

Try something like this: 

 

MsrRankNo0 = 
IF(
    CALCULATE(SUM(Sheet1[Sales])) <> 0,
    RANKX(ALL(Sheet1),CALCULATE(SUM(Sheet1[Sales])),,1,Skip) - 1
)

You have to subtract 1 to get the rank to start at 1. The calculate expressions are necessary; otherwise, you will get 1s for your ranks. Here is how that turned out on my test data:

 

Screenshot.jpg

 

 

hi, @ccakjcrx @gooranga1 @MarcelBeug @vanessa

 

Unfortunately it did not work out.
I am sending the file for better understanding.

 

Sales.pbix

 

Thank you for your help.

Hi @Rfranca,

 

Try this measure in the Mx_sales table

 

=RANKX(FILTER(All('PRODUCT'[ProductName]),[Ttotal_Sales]>0),[Ttotal_Sales],,ASC,Skip)

 

In the Visual level filters, apply a criteria on the Ttoal_Sales of >0

 

Hope this helps.

 

Untitled.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

hi, @Ashish_Mathur

 

Many thanks, it worked!

I forgot the criterion of the visual level filter.

 

Clipboard01.gif

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

how to avoid zero values while ranking?

Hi,

That is what my formula suggested on Jan 18, 2018 should do.  If it is not working as expected, then share some data, describe the question and show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.