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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

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
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.