Create a histogram using a DAX measure in Power BI
If you need to create a histogram out of the results of a measure, here is how to do it!
Watch the YouTube video
The code used
The DAX needed for the x-axis is:
Histogram =
VAR max_event = MAXX(VALUES('Events'[DeviceId]), [Events per device])
return
GENERATESERIES(1,max_event,1)
and for the y axis:
Histogram Events =
VAR valuesToCount =
FILTER(
ADDCOLUMNS(
SUMMARIZE('Events', 'Events'[DeviceId]),
"events",[Events per device]
),
[events] = SELECTEDVALUE('Histogram'[Value])
)
RETURN COUNTROWS(valuesToCount)
Download the file
The demo file in in the download center, get file 272.
Related Resources

Was this helpful?
Reader Interactions