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

Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.

Reply
abrahamfariaz
Frequent Visitor

Top 3 for each bar in a bar chart

I have a bar chart that displays the number of discrepancies per picker (person), and I want to identify the top 3 products (CUF) with discrepancies for each person. My current bar chart looks like this:

abrahamfariaz_0-1707337391350.png

However, if I include CUF in the legend, I encounter two issues:

abrahamfariaz_1-1707337475503.png
1) It changes the total for each bar
2) If I set a top 3 by CUF count, the chart disappears

abrahamfariaz_2-1707337524259.png

¿Can somebody help me? Thanks!!

5 REPLIES 5
Daniel29195
Super User
Super User

@abrahamfariaz 

 

i took a look at the file , this is what i noticed : 

first : if we take De la Vega Walter  as  an example ,

the top 3 cuf per for him per count of cuf , have 

Recuento diferencias  , 2 of them blank, and one with one value . 

Daniel29195_0-1707341649710.png

this can be seen in the visual below , as excepted : 

Daniel29195_1-1707341849129.png

 

if this is what you want : 

this is the measure to write and you use it in the visual :

Measure 2 = 
var ds = 
TOPN(
    3,
    ALLSELECTED('329 + 12 + Artículos'[CUF]),
    [Measure],
    DESC
)

var c  = 
CALCULATE(
    [Recuento diferencias],
    KEEPFILTERS(ds)
)

return c 

 

 

 

let me know if this helps .

 

 

 

If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠

 

Hello @Daniel29195 ! Thank you very much for helping me with this challenge.
Unfortunately, I didn't understand your point with the example of De la Vega Walter. I don't have null values in the table 329 + 12 + Articles.
What I need, in case I didn't explain myself correctly, is to display the TOP 3 CUFs per person or picker. I currently solved it with a tooltip, but I would like it to be inside each bar of the chart.abrahamfariaz_0-1707413518628.png

 

@abrahamfariaz 

 

Daniel29195_0-1707418845095.png



this is the caluclation of yhe measure you are using in the bar chart.

 

so for the top3 ( base on count of cuf )   for De la Vega Walter,  this measure returns blank for 2 of the 3  .

 

 

abrahamfariaz
Frequent Visitor

Hi,

Try this measure

Measure = CALCULATE([Recuento diferencias],TOPN(3,ALL('329 + 12 + Artículos'[CUF]),[Recuento diferencias]),VALUES('329 + 12 + Artículos'[CUF]))

Hope this helps.

Ashish_Mathur_0-1707349805808.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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