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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
shaowan
Employee
Employee

Show top N values in clustered column chart

I have column chart the x is date and the y is max of a numberic, the legned is the object type(contain 25 types every day). I only want to show object type of  the top 3 y value

1 ACCEPTED SOLUTION

@shaowan 

 

Sample Table

 

CategoryProductSales
AA1200
AA2250
AA3300
AA4350
AA5400
BB1450
BB2500
BB3550
BB4600
BB5650
BB6700

 

 

 

SalesValue = SUM(CPS[Sales]) 
Rank = 
var _selectedCategory= SELECTEDVALUE(CPS[Category])
var _rank=RANKX(FILTER(ALL(CPS),CPS[Category]=_selectedCategory),[SalesValue])
return _rank

 

 

 nor.JPG

Now apply the visual level filter. (show item when the value: Rank is less than or equal to 3)

 

Capture.JPG

 



Did I answer your question? Mark my post as a solution!
Appreciate with a kudos
🙂


Regards,
Nandu Krishna

View solution in original post

7 REPLIES 7
TramLe
New Member

TramLe_0-1711942803140.png

It's working for me. But why distance of each columns are too far and not aligned?

 

nandukrishnavs
Super User
Super User

@shaowan  You could try TopN visual level filter.

Capture.JPG



Did I answer your question? Mark my post as a solution!
Appreciate with a kudos
🙂


Regards,
Nandu Krishna

Thanks but that's not I want, I want to show top 3 types in every date.

@shaowan 

 

You have to create one measure for ranking. 

Refer to this- https://www.sqlbi.com/articles/filtering-the-top-3-products-for-each-category-in-power-bi/

If you are still confused, please share your sample table and expected output.



Did I answer your question? Mark my post as a solution!
Appreciate with a kudos
🙂


Regards,
Nandu Krishna

Capture.PNG

 

@shaowan 

 

Sample Table

 

CategoryProductSales
AA1200
AA2250
AA3300
AA4350
AA5400
BB1450
BB2500
BB3550
BB4600
BB5650
BB6700

 

 

 

SalesValue = SUM(CPS[Sales]) 
Rank = 
var _selectedCategory= SELECTEDVALUE(CPS[Category])
var _rank=RANKX(FILTER(ALL(CPS),CPS[Category]=_selectedCategory),[SalesValue])
return _rank

 

 

 nor.JPG

Now apply the visual level filter. (show item when the value: Rank is less than or equal to 3)

 

Capture.JPG

 



Did I answer your question? Mark my post as a solution!
Appreciate with a kudos
🙂


Regards,
Nandu Krishna

Thanks so much, it fixs my problem!

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.