Forum Discussion

umeshgupta052's avatar
umeshgupta052
New Member
20 days ago
Solved

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.

  • 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.

4 Replies

  • ShahRukhSameer's avatar
    ShahRukhSameer
    Icon for Continued Contributor rankContinued Contributor

    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.

    • umeshgupta052's avatar
      umeshgupta052
      New Member

      The issue is brand changes with category like food nutrition so i want a scalable solution where i can color code brand with category and creating a static table means if in future new brand vome in it wont be taken care of

  • v-csrikanth's avatar
    v-csrikanth
    Icon for Community Support rankCommunity Support

    Hi umeshgupta052​ 

    We would like to inquire whether have you got the chance to check the solutions provided by other users in community to resolve the issue. We hope the information provided helps to clear the query. Should you have any further queries, kindly feel free to contact the Microsoft Fabric community.

  • v-csrikanth's avatar
    v-csrikanth
    Icon for Community Support rankCommunity Support

    Hi umeshgupta052​ 

    We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet. And, if you have any further query do let us know.

    Thank you.