Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
I'm trying to generate a distribution graph based on test results, allowing filtering by underlying variables within the sum for each run. For instance, if I select variables x1 and x2, the distribution should reflect only those variables, not the entire set (x1 + x2 + x3 + x4 ... + xn).
The challenge lies in generating bins along the x-axis and counts along the y-axis to visualize the distribution of results per run. My current idea involves creating custom dynamic bins and utilizing TREATAS to reference a table with a series. However, I am unsure if this is the correct method. I would appreciate assistance in figuring out how to implement this.
Below are my current measures and tables in the solution that does not work,
Data table:
Variable | Run | Value |
x1 | r1 | y1 |
x1 | r2 | y2 |
x1 | ... | y3 |
x1 | r | y4 |
x2 | r1 | y5 |
x2 | r2 | y6 |
x2 | ... | y7 |
x2 | r | y8 |
...and so on |
Messured used in y-axis:
Test 1 =
//Creates a table that sum for each run
VAR _simTable = SUMMARIZE(Sim_result, Sim_result[Run], "Result", SUM(Sim_result[Value]))
//Steps used in the series table ex. 1000 = -3
VAR _roundValue = -3
//Get max & min value of t
VAR _maxRes = MAXX(_simTable, [Result])
VAR _minRes = MINX(_simTable, [Result])
//Number of bins
VAR _binsN = 100
//Bin size
VAR _midRes = _minRes + (_maxRes - _minRes) / 2
VAR _binSize = ROUNDDOWN((_maxRes - _midRes) / (_binsN / 2 - 1), _roundValue)
//Creates new table with bins
VAR _simBinTable = ADDCOLUMNS(_simTable, "Result bin", MROUND([Result], _binSize))
VAR _simBinColumn = SELECTCOLUMNS(_simBinTable, "Result bin", [Result bin])
RETURN
CALCULATE(
COUNTX(_simBinTable, [Result bin]),
TREATAS(
_simBinColumn,
'Simulation bins'[Value]
)
)
To generate table with bins for x-axis:
Simulation bins =
//Creates a table that sum for each run
VAR _simTable = SUMMARIZE(Sim_result, Sim_result[Run], "Result", SUM(Sim_result[Value]))
//Steps used in the series table
VAR _steps = 1000
VAR _roundvalue = -3
//Get max & min value of t
VAR _max = MAXX(_simTable, [Result])
VAR _min = MIN(Sim_result[Value])
VAR _generate = GENERATESERIES(
ROUNDDOWN(_min, _roundvalue),
ROUNDUP(_max, _roundvalue),
_steps
)
RETURN
_generate
Solved! Go to Solution.
My current idea involves creating custom dynamic bins
That's not something you can do in Power BI. You'd have to look at custom visuals like Deneb, or other BI tools like Tableau which has LOD features.
My current idea involves creating custom dynamic bins
That's not something you can do in Power BI. You'd have to look at custom visuals like Deneb, or other BI tools like Tableau which has LOD features.
I looked at examples from RADCAD.com (see links) and thought they might work in my situation. Thank you for the tip; I'll explore custom visuals more deeply. Thank you!
https://radacad.com/age-banding-in-power-bi-using-treatas-dax-function-relationship-based-on-between
https://radacad.com/dynamic-banding-or-grouping-in-power-bi-using-dax-measures-choose-the-count-of-b...
I guess you can argue about the meaning of "dynamic". In Power BI you can only use buckets that you have defined beforehand.
Thank you btw, got it to work with Deneb
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
79 | |
73 | |
58 | |
36 | |
32 |
User | Count |
---|---|
90 | |
62 | |
61 | |
49 | |
45 |