Forum Discussion
Color for Max on Bar Chart formula not working
I'm new to power bi and I'm trying to color the min and max column in my bar chart differently from the rest of the bar chart columns. I've looked at different options online. None of the formulas error out, they just don't work. This is one of the formulas I've tried. But none of the formulas I've tried have worked
var v1=
maxx(ALLSELECTED(point_balance_by_member[point_bin]),calculate(COUNT(point_balance_by_member[user_id])))
var v2=
minx(ALLSELECTED(point_balance_by_member[point_bin]),calculate(COUNT(point_balance_by_member[user_id])))
return
if(count(point_balance_by_member[user_id])=v1,"Dark Blue",if(count(point_balance_by_member[user_id])=v2,"Light Blue","Green"))
Hello Anonymous
Here you can go
Thanks,
Pankaj Namekar | LinkedInIf this solution helps, please accept it and give a kudos (Like), it would be greatly appreciated.
8 Replies
- pankajnamekar25
Super User
Hello Anonymous
Here you can go
Thanks,
Pankaj Namekar | LinkedInIf this solution helps, please accept it and give a kudos (Like), it would be greatly appreciated.
- AnonymousNot applicable
Thank you pankajnamekar25 it worked. Though I don't understand why, since the gray is >= and <=, which is inclusive of 0 and 100, which would overlap with the next two rules, and none of the bars technically are 100% or 0%. I'll have to do more research. Thank you again!!!
- v-venuppu
Community Support
Hi Anonymous ,
As this thread is already solved, please create a new thread in the forum community.We are happy to help.
Thank you.
- Ashish_Excel
Solution Supplier
Hi,
Share the download link of the PBI file.
- v-venuppu
Community Support
Hi Anonymous ,
Thank you for reaching out to Microsoft Fabric Community.
Thank you Ashish_Excel pankajnamekar25 for the prompt response.
I have created sample pbix file by using sample data to replicate the scenario.
You can find the attached .pbix file for your reference.
After creating chart , Apply Conditional Formatting
Select the chart.
In the Visualizations > Format pane, expand Columns > Colors.
Set:
Format by: Field value
Based on field: BarColor measure
If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it!
Thank you.
- AnonymousNot applicable
Regretfully this had the same effect as my formula, i.e. it formatted all bars as though they were the max. I thought possibly it was because I had the count of user id displayed "show values as percent of total" but when I returned to "no calculation" (just showing the counts and not the percent) the same result. However pankajnamekar25 response did work. I'm sure it's something I'm doing, so hopefully I'll get better at this. Thank you.
- AnonymousNot applicable
I was unable to understand why this works. I now now have a parameter instead of a single measure that I am trying to format similarly. Is there a way to format conditionally similarly when the measure used in the column chart is a parameter choice with a slider. Maybe I should start another post (?)
- Ashish_Mathur
Super User
Hi,
Share the download link of the PBI file. Explain (in a text box) the expected result there.