Forum Discussion

umeshgupta052's avatar
umeshgupta052
New Member
9 hours ago

Color Coding Issue

I have a PBI report in which I am using a tree map visual and I have coded few brands but for rest which i dint coded is having duplicate color issue, I am searching for a optimised solution for color coding where instead of doing it manually i can do it in some other optimised way.

1 Reply

  • Hi umeshgupta052​,

    One approach that works well is to avoid manually assigning colors to every brand. Instead, create a dedicated Brand Color mapping table and use it across the report.

    For brands that need specific corporate colors, store them in the mapping table. For all other brands, use a DAX measure so new brands automatically receive a consistent color without manual maintenance.

    Brand Color =

    VAR CustomColor = LOOKUPVALUE( BrandColors[Color], BrandColors[Brand], SELECTEDVALUE(Sales[Brand]) )

    RETURN IF( NOT ISBLANK(CustomColor), CustomColor, "#" & RIGHT( FORMAT( ABS(HASH(SELECTEDVALUE(Sales[Brand]))), "X" ), 6 ) )

    Then use this measure in Conditional Formatting > Data Colors > Format by Field Value.

    For enterprise-scale reports, I would recommend maintaining a Brand Dimension table with a Color column and using that as the single source of truth for color mapping throughout the report. This is usually much easier to manage and govern than setting colors individually in each visual.