Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
Hi,
I would like to create a general quantile report in a bar chart style. I am not sure how to this. See my below example. I did not find any downloable custom charts for this. My underlying dataset is organized as follows. In my dataset there are N locations (classes if you want) and for each location (or class) a large number of observations which should be put into the respective quantiles. The reason why I want to avoid boxplot is that the resulting report should be included in a publication to the general public, i.e. to non-statisticians, for marketing purposes. Custom quantiles should be used instead of quartiles as well. How can I do this most efficiently?
This can be done with the Deneb visual. I did a quick POC but much more could be done to pretty it up. You should be able to take the code below, put it in the visual and edit the field mapping (to switch it to your data).
Declarative Visualization in Power BI | Deneb
{
"data": {"name": "dataset"},
"transform": [
{
"aggregate": [
{
"op": "min",
"field": "Total Sales",
"as": "Min"
},
{
"op": "max",
"field": "Total Sales",
"as": "Max"
},
{
"op": "median",
"field": "Total Sales",
"as": "Median"
},
{
"op": "q1",
"field": "Total Sales",
"as": "Q1"
},
{
"op": "q3",
"field": "Total Sales",
"as": "Q3"
}
],
"groupby": ["Subcategory"]
}
],
"layer": [
{
"mark": {
"type": "bar",
"color": "red"
},
"encoding": {
"y": {
"field": "Min",
"type": "quantitative"
},
"y2": {"field": "Q1"}
}
},
{
"mark": {
"type": "bar",
"color": "blue"
},
"encoding": {
"y": {
"field": "Q1",
"type": "quantitative"
},
"y2": {"field": "Median"}
}
},
{
"mark": {
"type": "bar",
"color": "green"
},
"encoding": {
"y": {
"field": "Median",
"type": "quantitative"
},
"y2": {"field": "Q3"}
}
},
{
"mark": {
"type": "bar",
"color": "yellow"
},
"encoding": {
"y": {
"field": "Q3",
"type": "quantitative"
},
"y2": {"field": "Max"}
}
}
],
"encoding": {
"x": {"field": "Subcategory"}
}
}
Pat
That looks good, but instead of the minimum value, the 25 % quantile, the median and the 75 % quantile and the maximum value, I should have the quantile boundaries 5 %, 25 %, 75 % and 95 %. How do I do this?
This page shows the available aggregations in Vega Lite (Deneb). If the ci0 and ci1 work for your 5 and 95%, you can easily adapt the earlier code with those instead. Otherwise, you would a DAX approach to get the 5 and 95 percentile.
Pat
Look good, but what is meant by "the lower boundary of the bootstrapped 95% confidence interval of the mean field value."? Is there a methodological difference to the calculation of the 25 % and 75 % quantiles? The term "bootstrapped" seems unclear to me, in this context.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
83 | |
78 | |
52 | |
37 | |
36 |
User | Count |
---|---|
104 | |
85 | |
47 | |
44 | |
42 |