Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Data colors based on another field values

I am pretty new to POWER BI. I have the below chart in Tableau and am trying to replicate this on to POWER BI. But not finding the option.

 

I have two Charts - Category and count of tickets, Subcategory and count of tickets. In Tableau I created a chart for Subcategory and simply drag-drop the Category field to color control. Which will give me the Subcategory bars coloured based on their respective Categry values. But struggling to find this option in POWER BI. Do we have this option in POWER BI ?

 

If you look at the "EUSR Provisioning" in the first chart, we have to subcategories underneath it which is Provision and Deprovision. Now the same color is applied in the second chart. I have this in Tableau but not sure on how to do this in POWER BI

 

 

  • Anonymous

     

    Hi, look the PBIX. with Conditional formatting you can create a measure and assign a color to each category (Yes, you need to know all the categories).

     

     

    ColorFormat =
    SWITCH (
        SELECTEDVALUE ( Table1[Category] ),
        "A"; "#000000",
        "B"; "#ff0000",
        "C"; "#ffa500",
        "D"; "#551a8b",
        "E"; "#98fb98"
    )
    

    A sample is attached.

     

    Regards

     

    Victor

     

12 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous,

     

    I think conditional formatting feature will suitable for your requirement, but current it seems only works on table and matrix visuals.

    Conditional formatting in tables

     

    Maybe you can submit an idea for add support for more visuals.

     

    Regards,

    Xiaoxin Sheng

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks for your suggestions. I will try submitting the idea..

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Anonymous,

         

        Have you tried putting the category in the legend? Or if possible could you please share a sample of your data. I believe it is achievable in power bi. 

         

         

        Best Regards,

        Ravi

  • Vvelarde's avatar
    Vvelarde
    Community Champion

    Anonymous

     

    Hi, In a direct way (with a drag and drop or selecting an option) is not possible for the moment.

     

    Regards

     

    Victor

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Any other indirect way please. Kindly share your ideas on to achieve this requirement please.

  • Vvelarde's avatar
    Vvelarde
    Community Champion

    Anonymous

     

    Hi, look the PBIX. with Conditional formatting you can create a measure and assign a color to each category (Yes, you need to know all the categories).

     

     

    ColorFormat =
    SWITCH (
        SELECTEDVALUE ( Table1[Category] ),
        "A"; "#000000",
        "B"; "#ff0000",
        "C"; "#ffa500",
        "D"; "#551a8b",
        "E"; "#98fb98"
    )
    

    A sample is attached.

     

    Regards

     

    Victor

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Do you know if it's possible to do this by using a table?  I have a table of vendors that I use across multiple Power BI reports that I'd like to be able to assign colors to for graphs/charts across the board rather than use as a measure.  

      • crenning's avatar
        crenning
        New Member

        Same here, I have the category colors in a database table and I'd like to use it in PBI visuals.

        Any help achieving this would be great.

         

  • Anonymous's avatar
    Anonymous
    Not applicable

    Same here, I have graphs with more than 50 categories and it takes a lot of time formatting one by one.
    If someone can help us please!!!

    how it looks in tableau vs how it looks in power bi