The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hello,
I will appreciate suggestions on formatting a bar chart --
x axis is club abbrev, Y axis is revenue per club.
User table (called userinfo) has user club abbrev (the club the user belongs to) and the user email.
Need to show diff color on the bar and club abbrev for each user based on the upn.
The below code works well to change the color of bars in a bar chart - using Format, Columns, Color -- fx.
But it does not work to change the colors of club abbrev on the x axis - using Format, x axis, values --- .
Color Bars =
VAR _upn = USERPRINCIPALNAME()
VAR _UserClub = CALCULATE(
MAX('a-vw_sponsorship'[club_abbrev]),
'UserInfo'[user_email] = _upn
)
RETURN
IF(
MAX('a-vw_sponsorship'[club_abbrev]) = _UserClub,
"#12239e", -- Blue for the user's club
"#b3b3b3" -- Gray for other clubs
)
I will appreciate any thoughts or suggestions.
Regards,
Pav
The issue here is that Power BI doesn’t support dynamic formatting of axis labels directly based on DAX logic.
Some custom visuals, like Deneb (Vega-Lite JSON-based) or third-party visuals, allow more flexible formatting, including the dynamic coloring of axis labels. Using these, you can dynamically format both bars and axis labels based on the same logic.
💌 If this helped, a Kudos 👍 or Solution mark would be great! 🎉
Cheers,
Kedar
Connect on LinkedIn
Thanks Kedar.
I looked but was not able to find the Deneb bar chart. Any specifics on how to find it?
I was trying to use the Format, X axis, Values, fx, and dax to make it work.
Thanks again!!
Hi @pbidani - Create a new measure that outputs the user's club abbreviation as a label
Highlighted Club =
VAR _upn = USERPRINCIPALNAME()
VAR _UserClub = CALCULATE(
MAX('a-vw_sponsorship'[club_abbrev]),
'UserInfo'[user_email] = _upn
)
RETURN
IF(
MAX('a-vw_sponsorship'[club_abbrev]) = _UserClub,
MAX('a-vw_sponsorship'[club_abbrev]),
BLANK()
)
Currently, you can highlight the user's club visually in the bars themselves and add supporting elements (like tooltips, legends, or secondary visuals) for further differentiation. If the formatting of the axis labels themselves is critical, you may need to wait for future updates to Power BI or use a custom visual.
Hope it works, please check
Proud to be a Super User! | |
Thanks Rajendra.
I was trying to use the Format, X axis, Values, fx, and dax to make it work.
Thanks again!!
User | Count |
---|---|
85 | |
84 | |
36 | |
34 | |
31 |
User | Count |
---|---|
92 | |
79 | |
66 | |
55 | |
52 |