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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
PowerRon
Post Patron
Post Patron

Combination Field parameter - TopN - Legend not working

Hi,

 

see my test.pbix

 

https://www.dropbox.com/scl/fi/puhpfn9b0cx17hnmos2ty/test.pbix?rlkey=tlzbha299p9yybf38xrkk1aye&dl=0 

 

In this pbix I combine a field parameter with a variable TopN.
Choosing in this situation for a Top5, 10 or 25 always gives the correct result.
But when I put the attribute Channel from query Sales in the Legend of the stacked bar chart, it gives strange results like this when choosing for Top5.

wrong Top 5.jpg

Why is this happening and how can I solve it? Because I would like to have that subdivision in the bars.

Regards
Ron

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@PowerRon update your measure to remove the filter from the channel column, as a good design there should be another dimension table for channels.

 

        SELECTEDVALUE(FP_Sales[Measures Fields]) = "'Sales'[Sum Sales Qty]",
        CALCULATE(
            RANKX(
                ALLSELECTED(Regions[Country]),
                [Sum Sales Qty],,DESC
            ), 
            REMOVEFILTERS(Sales[Channel] ) 
        )

 

parry2k_0-1701725522863.png

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

2 REPLIES 2
parry2k
Super User
Super User

@PowerRon update your measure to remove the filter from the channel column, as a good design there should be another dimension table for channels.

 

        SELECTEDVALUE(FP_Sales[Measures Fields]) = "'Sales'[Sum Sales Qty]",
        CALCULATE(
            RANKX(
                ALLSELECTED(Regions[Country]),
                [Sum Sales Qty],,DESC
            ), 
            REMOVEFILTERS(Sales[Channel] ) 
        )

 

parry2k_0-1701725522863.png

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Hi @parry2k  

I agree that Channel should be in a separate dimension. 
Can you explain to me in a simple way why I should use REMOVEFILTERS here?
If Channel was in a separate dimension, wouldn't it have occured then?
By the way, thnx for helping me out !

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.