Forum Discussion
Custom Report, displaying general quantiles in bar chart style instead of boxplot
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?
- ppm13 years ago
Solution Sage
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
- centroid3 years ago
Helper I
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.