Being able to have a shaded area between two lines has been high on my requirements list. This area fill is mainly used to highlight variance between two categories on a line chart. With a bit of DAX it was possible before but it now became a lot more easy with the introduction of error bars. Let’s go through some examples.

On the top left you see some example data of an actual and a target. To focus the attention of the user to the user to the difference between the lines we can use shading in different ways. The new Error Bars functionality in PowerBI opens up a lot of possibilities to easily do this. This option can be found under the analytics pane in the Visualizations Pane.

To create a shaded area between the two lines we need to activate the error bars and adjust some settings. The real magic happens under the Error band option.

Under Option Enable = On

Set the Upper Bound of the Actual Serie to The Target

Disable the Bars

Enable the Error Band

 

There is now a shaded area between the two lines.

To be able to assign a different color to the area above and below target we need a bit of DAX first. We need a reference line which tells us the lowest (or highest) value available at each data point.

We again the settings of the Error bars but now use the Lowest value measure to work against. The lowest value measure is set as the Lower Bound for the target and as Upper Bound for the Actual.
Again we disable the Bar and enable the Error band for both series and assign the color we want to the shaded area.

These are the basics of creating a shaded area with two lines using error bars. Start experimenting and using the error bands and bars to come up with a different look and feel that suits your needs.

Geef een reactie

Het e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *