Forum Discussion

SinghArchana's avatar
SinghArchana
Frequent Visitor
6 months ago
Solved

Consistent color mapping across visuals in Power BI reports

Hi All, I am working on standardizing report design across multiple Power BI reports and ran into a limitation with color management. Currently, when using conditional formatting or color by fi...
  • Juan-Power-bi's avatar
    6 months ago

    The standard solution for this is a color mapping table + DAX conditional formatting measure, and it scales well across large reports.
    Step 1 — Create a color mapping table (either in Power Query or as a calculated table):
    CategoryHexColorProduct A#4472C4Product B#ED7D31Product C#A9D18E
    Step 2 — Create a DAX measure that looks up the color for the current context:
    daxCategory Color =
    LOOKUPVALUE(
    ColorMapping[HexColor],
    ColorMapping[Category],
    SELECTEDVALUE('Products'[Category]),
    "#BFBFBF" -- default fallback color
    )
    Step 3 — Apply to each visual via Format → Data colors → fx (conditional formatting) → Field value → select your Category Color measure.
    Yes, you still have to wire it up per visual — there's no true global binding in Power BI today — but you only define the colors once in the mapping table. When you need to change Product A's color, you update one row and it flows everywhere automatically.
    For cross-report consistency, the cleanest approach is to put the color mapping table in a shared semantic model that all reports connect to. Then every report uses the same source of truth.
    Bonus tip: You can also embed the color mappings directly in the report theme JSON under dataColors with named entries, but that approach only works reliably for series order, not specific category-to-color bindings. The DAX measure method is more robust for named categories.

  • cengizhanarslan's avatar
    6 months ago

    1) Create a color mapping table

    Create a small table that defines the color for each category.

     

    2) Create a color measure

    Return the color based on the current category.

    Product Color =
    SELECTEDVALUE ( ProductColorMap[Color] )

     

    3) Apply conditional formatting

    In each visual:

    Format → Data colors → Conditional formatting → Format by: Field value

    Select the Product Color measure.