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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.