Here is how to create a jitter chart in Power BI with averages by categories and using only Power BI and DAX capabilities. No custom visualizations are necessary. A jitter chart makes it easier to view overlapping data points by categories.
If you want to understand this technique in more detail, look at this post from this blog that contains an example in Excel. The main principle of creating a jitter plot is the same.
In this example, I’m using data from this data set that contains daily temperature measurements in New York from May to September 1973.
If you want to obtain that, you can use this M code in the blank query or download the pbix file with the result.
Here is my data and M code for that. The table name is air quality. I would like to visualize temperatures by month. The month name column is sorted by the column that contains the month number.
Jitter chart in Power BI
Usually, with the jitter chart, I will look at the modified scatter chart. At this moment, Power BI is not flexible enough. In my scenario, I would like to show Power BI jitter plots by month name category. I will use a line chart with only markers and small multiples.
Within each category, data points should be separated to avoid overlap. To do that, you can calculate jitter like this. You can divide jitter or multiply with a decimal number to acquire optimal dispersion. Try to provide a divisor by using the what-if parameter, like in this example.
Jitter = (RAND()-0.5)/3
The next step is to create a line chart with markers and remove the line (0 px stroke), x-axis content, and unnecessary elements.
Now add the category to the small multiples section, arrange small multiples in one row (you can do that by adjusting the column count that equals the category count), and do some formatting.
Average line by categories in Power BI
You might be happy with the jitter plot in Power BI as it is, but here is how to add additional measures by category. Here is how to create a measure of averages, ignoring the jitter within each category using the REMOVEFILTERS function.
Average Temperature = CALCULATE ( AVERAGE ( airquality[Temp] ), REMOVEFILTERS ( airquality[Jitter] ) )
Add this to Y-axis values and format.
If you want something more complex, try to use R script visuals. In this blog, you can find a couple of examples.
Here is a simple R jitter plot by categories, and here is another with additional measures.
Here is a jitter plot with the average line in Excel.