Greater Houston Texas Power BI Users

Please login or click SIGN UP FOR FREE to create your PowerBIUG account to join this user group.
Expand all | Collapse all

Conditional formatting in charts

  • 1.  Conditional formatting in charts

    Bronze Contributor
    Posted 29 days ago
    Is there a way to add formatting in charts, I could see that option in tables but not charts. I need my chart to display red/yellow/green based on the value ranges.

    Please advise.

    ------------------------------
    Regards,
    Geethika
    ------------------------------


  • 2.  RE: Conditional formatting in charts

    Silver Contributor
    Posted 29 days ago
    If the chart has a "legend" well for a data field, it's usually possible to apply the color formatting you desire. I would recommend creating a calculated column which can calculate a value that will categorize each value into red/yellow/green. Then you can use this column in the legend field, and set the data colors for each value. If you have a screenshot or example you can share, that would be very helpful.



    ------------------------------
    Brent Lightsey
    Analytics Consultant
    FirstLight Analytics
    Oklahoma, USA
    ------------------------------



  • 3.  RE: Conditional formatting in charts

    Bronze Contributor
    Posted 28 days ago
    I was able to do this in a table, screenshot below. I was asked to do this in a chart format.


    ------------------------------
    Regards,
    Geethika
    ------------------------------



  • 4.  RE: Conditional formatting in charts

    Silver Contributor
    Posted 28 days ago
    You cannot use the built in "conditional formatting" on the stacked bar chart (that I know of). But here is a workaround. (My sample data is attached, and just has a date and value field).

    1. Create a calculated column that will indicate how the bar should be colored. I did mine like this:
      Color_Category = 
      SWITCH(
          TRUE(),
          Sheet1[Value] <= 641, "Green",
          Sheet1[Value] < 960, "Yellow",
          "Red"
      )​
      2. Set the bar chart fields as follows:
      3. Set the formats like this:
      4. The chart looks like this:






    ------------------------------
    Brent Lightsey
    Analytics Consultant
    FirstLight Analytics
    Oklahoma, USA
    ------------------------------



  • 5.  RE: Conditional formatting in charts

    Silver Contributor
    Posted 28 days ago
    I'm attaching the files used in my message above.

    ------------------------------
    Brent Lightsey
    Analytics Consultant
    FirstLight Analytics
    Oklahoma, USA
    ------------------------------

    Attachment(s)

    pbix
    color_bar_chart.pbix   43K 1 version
    xlsx
    pbisampledata.xlsx   8K 1 version


  • 6.  RE: Conditional formatting in charts

    Bronze Contributor
    Posted 28 days ago
    Thank you!!

    ------------------------------
    Regards,
    Geethika
    ------------------------------