Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
I have some data that looks like this:
| Employee ID | Age (years) |
| 1 | 100 |
| 2 | 1 |
| 3 | 18 |
| 4 | 21 |
| 5 | 65 |
| 6 | 7 |
| 7 | 12 |
| 8 | 18 |
| 9 | 24 |
| 10 | 36 |
I am trying to create a histogram that shows this data, with a slicer that will allow my users to define the size of the bins that are present in the visual.
There is a blog post that many people have pointed to that solves this problem. I am trying to follow this method exactly, but the slicer it creates is not interacting with my visual. Does this method still work after the recent updates to the 'New Parameter' Menu?:
https://radacad.com/dynamic-banding-or-grouping-in-power-bi-using-dax-measures-choose-the-size-of-bi...
Solved! Go to Solution.
Hi @prattja9
With the new New Parameters menu, select Numeric Range. It works with the link you supplied. (pbix: 2 - Choose SIZE of Bins.pbix)
Let me know if you have any questions.
pbix: prattja9.pbix
Does this help? I changed to COUNTROWS( DimCustomer ) to
Count of Customers in each Band - by size - 2 =
VAR _minAge = [Min Age]
VAR _maxAge = [Max Age]
VAR _bandSize = [What is Band Size Value]
VAR _AgeBandTable =
GENERATESERIES(
_minAge,
_maxAge,
_bandSize
)
VAR _currAge = SELECTEDVALUE( 'Age Band'[Age] )
VAR _bandHead =
MAXX(
FILTER(
_AgeBandTable,
[Value] <= _currAge
),
[Value]
)
VAR _bandTail = _bandHead + _bandSize
RETURN
IF(
_currAge = _bandHead,
CALCULATE(
DISTINCTCOUNT( 'DimCustomer'[Employee ID] ),
'Age Band'[Age] >= _bandHead
&& 'Age Band'[Age] < _bandTail
)
)pbix: prattja9.pbix
Hi @prattja9
With the new New Parameters menu, select Numeric Range. It works with the link you supplied. (pbix: 2 - Choose SIZE of Bins.pbix)
Let me know if you have any questions.
pbix: prattja9.pbix
Interesting, I got it to work with the sample BI report. Another question, my actual data set has multiple line items for each employee. Is there a way to modify the 15th line in the "Count of Customers in each Band - by size" measure to accomodate that complication?
Does this help? I changed to COUNTROWS( DimCustomer ) to
Count of Customers in each Band - by size - 2 =
VAR _minAge = [Min Age]
VAR _maxAge = [Max Age]
VAR _bandSize = [What is Band Size Value]
VAR _AgeBandTable =
GENERATESERIES(
_minAge,
_maxAge,
_bandSize
)
VAR _currAge = SELECTEDVALUE( 'Age Band'[Age] )
VAR _bandHead =
MAXX(
FILTER(
_AgeBandTable,
[Value] <= _currAge
),
[Value]
)
VAR _bandTail = _bandHead + _bandSize
RETURN
IF(
_currAge = _bandHead,
CALCULATE(
DISTINCTCOUNT( 'DimCustomer'[Employee ID] ),
'Age Band'[Age] >= _bandHead
&& 'Age Band'[Age] < _bandTail
)
)pbix: prattja9.pbix
Got it to work using CALCULATE(DISTINCTCOUNT( instead of CALCULATE(COUTROWS(.
Thanks for your help!
Sorry. I didn't see this post until I posted.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 48 | |
| 43 | |
| 39 | |
| 19 | |
| 17 |
| User | Count |
|---|---|
| 69 | |
| 63 | |
| 32 | |
| 31 | |
| 23 |