Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Highlight bars in a combination chart (conditional formatting of bars)

I need to highlight the bar for the latest month with a deviating colour in a combination chart.
Preferably not just the latest month but the value for that month in the past years of data being shown.

How can this be done?

  • Anonymous's avatar
    Anonymous
    2 years ago

    I was unable to highlight the bars in the combo-diagram, but I could conditionally format the Total-labels per bar.

     



8 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous 

     

    SamWiseOwl Thank you very much for your prompt reply, please allow me to share some content here.


    ​As you know, there is no way to highlight it. However, you can try presenting the data in other ways, such as:

     

    Create a date table, dynamically obtain the latest date, and display the same month data by selecting the date through the slicer.

     

    Create a table.

     

    DATE = 
    CALENDAR(
        DATE(YEAR(TODAY()), MONTH(TODAY()), DAY(TODAY())), 
        DATE(YEAR(TODAY()), MONTH(TODAY()), DAY(TODAY()))
    )

     

     

    Create a slicer.

     

    Create a measure.

     

    Measure = 
    var _date = MONTH(SELECTEDVALUE('DATE'[Date]))
    RETURN 
    IF(
        ISFILTERED('DATE'[Date]),
        CALCULATE(
            SELECTEDVALUE('Table'[value]),
            FILTER(
                'Table',
                MONTH('Table'[date]) = _date
            )
        ),
        SELECTEDVALUE('Table'[value])
    )

     

    Create a visual.

     

     

    When you select a date in the slicer, visual dynamically displays the data for the same month.

     

     

     

    Regards,

    Nono Chen

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

     

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      I was unable to highlight the bars in the combo-diagram, but I could conditionally format the Total-labels per bar.

       



    • Anonymous's avatar
      Anonymous
      Not applicable
      Thank you . great idea!
  • Anonymous's avatar
    Anonymous
    Not applicable

    Yes, unfortunately I need to have either 2 y-axis series/columns or a legend in the combo chart.

  • Hi Anonymous ,

     

    Create a measure similar to this but with your column names:

    Colour Measure =
    IF(
        SELECTEDVALUE(Purchase[PurchaseDate].[Month]) = Format(TODAY(),"MMMM")
        ,"Yellow"
        ,"Teal"
        )

     

    SelectedValue lets you reference a single value in a column, in this case the name of the month column. Test that against this months value. Alternatively you could do FORMAT(MAX(Table[DateColumn]), "MMMM") to make it based on the highest value in your data.

    Then go to your Columns settings and set Format Style to Field value and select this measure.

    If this helps please mark the answer as solved so others can find it.


    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks SamWiseOwl, but is unfortunately not possible for me to choose to use a formula in the bar colour section, there is no such option:


      • SamWiseOwl's avatar
        SamWiseOwl
        Icon for Super User rankSuper User

        Do you have something in the legend? Or two items in the column y-axis?
        You can't have multiple series and conditional formatting.