Forum Discussion
Strange Legend Error
My stacked bar chart started acting strange after a refresh of my data. I don't even know how to explain it but it seems like my legend categories started breaking up for no reason.
Here's an example:
Count of index should be 35 for 'Medium' so 11 + 24 but for some reason in my visual these are not showing as one but rather as two separate bars - even the color is different and the one on the right doesn't even have data labels... and I have the same issue with all the other legend categories.
The weirdest thing is that when I go into format data color for this visual I only have the three options (Low, Medium, High - see screenshot) and there is no duplication of 'Medium' or 'Low' etc.
So my legend doesn't even sync up with what the visual shows.
I have no idea what might be causing this issue as literally nothing in the data has changed in the columns used in this visual.
Any ideas?
- Anonymous7 years ago
The strangest thing is that I have recreated the visual in a new report (copying and pasting all the query steps to make sure it is essentially the same data) and the visual works perfectly there! So it's definitely not the data but almost like something is broken in that specific Power BI report file itself.
9 Replies
- mwimbergerResolver II
Hi Anonymous
It may be that there is an "other" category with some data or calculated bands not being handled correctly. Might want to check the calculation by copying the legend to a matrix visual and seeing it there is a new category that is not Low , Medium or High. It may be that the <= , > logic has created a gap somewhere and didn't show up before with previous data.
I had this problem before and a check on the measures logic helped.
If you need help debgging the logic, maybe post that and I can give it a look over
Cheers
Manfred
- AnonymousNot applicable
mwimberger This is what it looks like in a matrix:
- mwimbergerResolver II
Hi Anonymous does your measure to assign bands have multiple "Low" and "Medium" Bands?
Here is something that I use to assign bandings.
Overall Impact Summary = switch(true(), [IMPACT]>=0 && [IMPACT< 0.25 ,"Low"", [IMPACT]>=0.25 && [IMPACT]< 0.5 ,"Medium"", [IMPACT]>=0.5 && [IMPACT]< 1 ,"High"", "Error")
If you need a table with upper and lower limits for bands I can give that example too.
Limit Band= CALCULATE ( VALUES ( tblBand[Band] ), FILTER ( tblBand, [IMPACT] >tblBand[Lower Value] && [IMPACT]<= tblBand,[Upper Value] ) )Where the tblBand may be something like this:
Band Lower Value Upper Value Low 0 0.25 Medium 0.25 0.5 High 0.5 1
- AnonymousNot applicable
mwimberger And I'm not even using measures in this visual:
But the strangest thing is that when I actually write a measure to calculate the number of 'Medium' ones for example then I get the correct 35.
- mwimbergerResolver II
Ahh right. Anonymous
Have you checked that the difference between COUNT and COUNTA ? I think that is where the problem lies. Count ( in the visual with no measures ) will just count numbers, dates and strings and Counta in your measure will count numeric values as well as non blank values, including text, dates and logical values.
Let me know if that helps
Cheers
Manfred
- AnonymousNot applicable
hey mwimberger
so not sure if I was clear enough on this but my measure is working perfectly. There is nothing wrong with the measure, it's when I DON'T use measures is when I start getting this issue. I'm just unsure why because it worked perfectly before but then started acting up after the latest refresh as mentioned in the OG post.
I don't actually want to use measures for this visual.
any ideas on how to make it work again?
- afahertyHelper V
Did anyone ever figure out the solution to this? I am having the exact same problem.