Dynamic groups in histogram
This demo shows a histogram where the bins dynamically adjust based on the selected filter context, making it suitable for scenarios with multiple slicers.
The underlying data comes from a subset of the Superstore dataset. The histogram displays the number of products sold across five price ranges (also known as bins). These bins are calculated by taking the difference between the minimum and maximum sale prices in the current filter context and dividing that range into five equal intervals. From this, the lower and upper boundaries of each bin are derived.
An additional technique is used to ensure the bins automatically update whenever the filter context changes. For example, if the minimum sale price shifts from $50 to $60 and the maximum changes from $200 to $250, all five bins are recalculated so that they now start at $60 and end at $250, rather than using the original range.
Because there is no native way to display dynamic bins directly on a bar chart, the bin ranges are shown using calculated text fields overlaid on the x-axis.