Forum Discussion
bdehning
6 months agoPost Prodigy
Automating Column colors for each year
I currently use Clustered Column Chart to show data by a field called Inception Year. I select and set the colors for eacy year by Formating Columns and applying Series settings for each year and se...
cengizhanarslan
6 months agoSuper User
Power BI does not support dynamic “auto-assign new color per new category” logic for specific values. The easiest approach would be instead of manually assigning colors, let DAX control the color.
Step 1) Create a color measure
Year Color =
VAR Yr = SELECTEDVALUE('Table'[Inception Year])
RETURN
SWITCH(
TRUE(),
Yr = 2024, "#4472C4",
Yr = 2025, "#ED7D31",
Yr = 2026, "#70AD47",
"#A5A5A5" -- default color for future years
)
Step 2) Apply to visual
-
Format → Data colors → fx
-
Format by: Field value
-
Based on field: Year Color