Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Dynamic Colors for Line Chart

We have a PBI report which shows the Year wise data on line chart . This data have assigned colors for each Year showing data. The issue we are facing ,whenever year changes on 01/01 of every year th...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi,Arul ,thanks for your concern about this issue.
    And I would like to share some additional solutions below.

    Hello,Anonymous .I am glad to help you.
    For your needs, the general solution is to set the conditional format, and for each year of data, set the corresponding color for it separately (based on the value of MEASURE)
    URL:
    Apply conditional table formatting in Power BI - Power BI | Microsoft Learn

    The problem is that this way is limited to some types of Visuals, for other Visuals where you can't set conditional formatting, if you want to set a specific display color for each year. As I understand it, the order of the color settings is based on the default order of the colors in the Theme you are currently setting up.
    Like this:

     

    Here is the issue and the official documentation.
    URL:
    Solved: How are theme colours assigned to series on a line... - Microsoft Fabric Community
    Use report themes in Power BI Desktop - Power BI | Microsoft Learn
     

    I've noticed that the color settings in the Theme seem to be limited to the first eight by default, here's my suggestion to you
    You can contact your team members to define a Theme file (JSON file)
    and set the color order of your implementation in it, and then use your own Theme, so that when power bi applies the member colors, they will be applied individually in the color order written in the file.
    like this:

    There are also some Theme File examples in the official documentation, hopefully they will help you.

    {
    "name": "Themetest",
    "dataColors": ["#003B64", "#FFF200", "#FFD500", "#A9E0EA", "#231F20", "#49494A", "#737474", "#9A9B9B", "#C3C4C4", "#E7E7E7", "#FFFFFF"],
    "background":"#FFFFFF",
    "foreground": "#A9E0EA",
    "tableAccent": "#FFD500"
    }

    Note that this is only an example, you will need to contact a member of your team who is proficient in front-end page design to collaborate on the Theme file.

    I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
    Best Regards,
    Carson Jian,
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.