Forum Discussion

Cretemeausernam's avatar
Cretemeausernam
Regular Visitor
6 years ago
Solved

define visual labels by table?

Hi,

 

I have a table of data sorted in this manner:

 

CategoryValue
A67
F76
A45
B30

 

I have a 2nd table with Category properties on it which includes hex colours

 

CategoryOriginColour

A

Europe118DFF
BAsiaAD5129
FUSAEC8FCA

 

 

What I'm trying to do is use the colour column in the category table to define the colour the category has in various visuals through reports (pie charts, stacked bar charts, line graphs)

 

This reason I don't want to do this manually is because the category table has 100s of rows.

  • Hi, Cretemeausernam 

     

    It is unsupported to format color for multiple visuals in Power BI Desktop currently. Visuals have different data points. You need to set a format for a specific visual. For tables and matrixs, you may use conditional formatting . For some other visuals, you need to define format for 'Data color'.

     

    I created sample data to reproduce your scenario. You may try the following measure.

    Measure = 
    LOOKUPVALUE(Category[Colour],Category[Category],SELECTEDVALUE('Table'[Category]))

     

    Conditional formatting for table visuals:

     

    Format for clustered column chart:

     

    Best Regards

    Allan

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

     

2 Replies

  • mahoneypat's avatar
    mahoneypat
    Microsoft Employee

    In query editor on transform tab, add # as a prefix to your colour column.  Then you can just use a measure like this to get your color code in a measure.  I named your example table Colors.  If you use Origin column in a visual, this will return you can use for the color (click on the fx button next to the color, choose Field Value and this new measure).

     

    Origin Color = SELECTEDVALUE(Colors[Colour])
     

    If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

    Regards,

    Pat

  • v-alq-msft's avatar
    v-alq-msft
    Community Support

    Hi, Cretemeausernam 

     

    It is unsupported to format color for multiple visuals in Power BI Desktop currently. Visuals have different data points. You need to set a format for a specific visual. For tables and matrixs, you may use conditional formatting . For some other visuals, you need to define format for 'Data color'.

     

    I created sample data to reproduce your scenario. You may try the following measure.

    Measure = 
    LOOKUPVALUE(Category[Colour],Category[Category],SELECTEDVALUE('Table'[Category]))

     

    Conditional formatting for table visuals:

     

    Format for clustered column chart:

     

    Best Regards

    Allan

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.