I find my stakeholders always require all the data points to be labelled on graphs.

However, if there are lot of data points, I think this can sometimes make it distracting to try and get an idea of the trend. Hence, as outlined in this post I’ve provided a simple solution to toggle between showing and hiding data points on graph.
The first step is to create a slicer that will be used to toggle between showing and hiding data points. In my case I’ve used a calculation group to create the slicer.
Alternatively, I could have just entered data to create simple table for the slicer as per the following:

The reason I’m using the calculation group is that I can extend my solution further to change the formatting of the data labels too.
On the model view in Power BI desktop – right-click and select new calculation group.

Then right-click and add the following calculation items.

Add this calculation group as a slicer to the page and set so only one option can be selected at a time.

The second step is to create a measure that will be used to hide or show the labels depending on what is selected in the slicer for this calculation group.

Key point is adding two zeros onto the hex code to hide the data label when the hide values option is selected in the slicer (“#00000000”).
The third step is to select the graph visual and set the data labels to on and the colour to be based on the measure created above.

Now when you toggle between the buttons Show Values or Hide Values, it shows or hides them 😉.


So, what is that extra button max min created for?
I added an additional step to show only the max and min in a series on the graph.

For example:

To calculate the maximum and minimum, can follow the steps as outlined here: Highlighting the minimum and maximum values in a Power BI matrix – SQLBI
Only twist is rather than using conditional formatting as shown in the link above. I use the same technique with the hex code to show and hide the data labels as needed.

Next question, what was that other calculation item I created for?
Just playing around with extending graphs further, so in this case to show the change from the prior month (absolute and percentage). I do this by using the calculation item to change the formatting of the data label of the measure that is used on the graph.
Only issue with this is I can’t use a legend which means I’m limited to one series (line) for example.

This video explains how to do it: 100% Control of Data Labels in Power BI – YouTube
With the updated version of Power BI desktop you can just set the formatting of the calculation item here. You don’t have to use tabular editor.

