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
JuradoKevin14
Frequent Visitor

Top N Slicer Not Working on Stacked Bar Chart

https://drive.google.com/file/d/1gX4B05MdvY5QmrNAakiU2Eq6Xy_OUWk4/view?usp=drive_link 

 

I have this existing Measure : 

Rank by Username = RANKX(all('TCM EncountersTCM'[UserName]), [Sum of nErrorsEnc],,DESC)

topN nErrorsEnc by Username = if([Rank by Username] <= 'Top Values'[Top Values Value], [Sum of nErrorsEnc])

 

JuradoKevin14_0-1709313398157.png

With this image above its working well

 

but when I used a legend it gives all the list of user see image below.

 

JuradoKevin14_1-1709313451872.png

 

My goal is just to put a legend on my Bar chart but when I do the visual breaks.

 

 

 

 

1 ACCEPTED SOLUTION

7 REPLIES 7
Anonymous
Not applicable

Hi, @JuradoKevin14 

Have you solved your problem? If so, can you share your solution here and mark the correct answer as a standard answer to help other members find it faster? Thank you very much for your kind cooperation!

Best Regards

Yongkang Hua

Anonymous
Not applicable

Hi, @JuradoKevin14 

In Power BI, legend fields can affect how data is grouped in visuals. When you add a field to a legend, Power BI might create a group for each unique value in that field, which may be why you're seeing all users and not just the top N users.

You can create a new column in your data that combines the username and error count.Use this new column for the axis of the bar chart. This will display both the username and the error count on the axis.

Add a legend field to the visual. Since the data is now grouped by User_Error columns, it should still only show the top N users based on errors.

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data)

 

How to Get Your Question Answered Quickly 

Best Regards

Yongkang Hua

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I kinda don't get your solution or I have tried it but it still doesnt work. I have attacehd a sample PBI file that has 2 sheets. 1 is the current and second is the Goal.

 

All data should be interactive by the slicer.

 

 

link asks for access - please check

Hi updated the link already. 🙂

Like this?

 

lbendlin_0-1710190319948.png

 

lbendlin
Super User
Super User

Not clear to me what you are trying to achieve.

 

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

Do not include sensitive information or anything not related to the issue or question.

If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

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.