Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
I created the following measure to assign colors to bars in a bar chart:
Solved! Go to Solution.
Hi @Vizard
The issue can come from the sum of your dimension index, instead of using sum, can you try the following dax code:
COLOR = SWITCH( SELECTEDVALUE(CASES_COVID_VARIANTS[index]),
1, "#A2A7A9",
3, "#8B4186",
4, "#be5150",
5, "#f26724",
6, "#faa21b",
7, "#80af5a",
8, "#1e988a",
9, "#0070b9",
10, "#132048",
11, "#c5a0c3",
12, "#d79392",
"#FFFFFF" )
Hi @Vizard
The issue can come from the sum of your dimension index, instead of using sum, can you try the following dax code:
COLOR = SWITCH( SELECTEDVALUE(CASES_COVID_VARIANTS[index]),
1, "#A2A7A9",
3, "#8B4186",
4, "#be5150",
5, "#f26724",
6, "#faa21b",
7, "#80af5a",
8, "#1e988a",
9, "#0070b9",
10, "#132048",
11, "#c5a0c3",
12, "#d79392",
"#FFFFFF" )
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.