I have a histogram of my entire dataset that I want to compare to a histogram of a filtered subset of that data. I can do this in two separate sheets, and then show them side by side in a dashboard.
Is there any way to combine these two histograms into a single chart with common axes rather than two charts side by side?
There are several ways to approach this. Here's two:
First define a calculated field that returns any non-null value for rows that match your filter criteria, and no value at all (i.e. null) otherwise. In the example below, the calculated field is called Matches Department and is defined as if [Department] = [Department to Show] then 1 end
where Department to Show is a parameter. Move the new calculated field to the Dimensions section of the data pane.
The first (easiest) solution is to make a histogram of Number of Records, and then place Matches Department on the Color shelf to get a stacked bar chart.
Here's a second variation, a bit more work to make a slightly different emphasis that may or may not be worth the effort to you.
Recall that the Count() aggregation function returns the number of rows that have a non-null value for its parameter. So CNT(Matches Department) returns the number of rows whose Department field matches the selected parameter.
So you can create a combo chart using CNT(Number of Records) and CNT(Matches Department) and then you can adjust the size on each measures marks card to show that one histogram is on top of the other. (Turn on dual axis, synchronize and then hide the second axis)
It looks pretty similar, but the red bars are actually narrower to emphasize that they are just a subset.
You could also make a bullet chart using the Show Me feature.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With