Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago

Clustered Bar chart with individual reference line

Hello, I've been trying to create a clustered bar chart with a reference line for each column bar, something like the image below. 
Does anybody knows if it is possible? The reference line is the value for the same variable but from X months before (can be 4, 8, or any other value)
Thanks

6 Replies

  • Anonymous , See if this can help

     

    I created something like this. Line Stepped - on, Marker - On. Marker --

    Line color - white

     

  • v-yingjl's avatar
    v-yingjl
    Icon for Community Support rankCommunity Support

    Hi Anonymous ,

    You can try to use the Analysis pane to set the reference line in power bi desktop.

    Please refer this document:

    https://docs.microsoft.com/en-us/power-bi/transform-model/desktop-analytics-pane

     

    If the line value is one of the previous month value, you can write a measure to calculate it and use this measure as the reference line.

     

    Best Regards,
    Yingjie Li

    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

      Hello Yingjie  thanks for your reply, unfortunetadly, this option only allows for a single reference line accross all the graph, which is not the requirement.

       

      Regards

  • v-yingjl's avatar
    v-yingjl
    Icon for Community Support rankCommunity Support

    Hi Anonymous ,

    To use the previous months value, you can create a meausre like this to calculate and use a month as a slicer:

    Measure =
    CALCULATE (
        SUM ( 'Table'[Sales] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[Date].[MonthNo]
                = SELECTEDVALUE ( 'Table'[Date].[MonthNo] ) - 2   //this calculate two months ago value,depends on the acutal need
                && 'Table'[Category] IN DISTINCT ( 'Table'[Category] )
        )
    )
    

    Enable the Stepped option under the Shape menu, change the measure color to white under Data colors menu, diable the legend option, the result would be like this:

    Attached a sample file in the below, hopes to help you.

     

    Best Regards,
    Yingjie Li

    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

    anks for both of your answers, unfortunetadly I realize that what I need is not possible, and since it is an executive presentation I'll see how to either change the layout or continue using the previous software for that particular chart and start creating new ones in PBI.

  • Anonymous I am trying to get the same seperate reference line for my dashboard. Have you been able to solve it. To get the reference line individual?

    If yes, can you share me of how you got that

     

    Thanks