Forum Discussion
Need help on building histogram
- 7 years ago
Hi @f_young2018
I don't think you can do your full scenario with the total number of devices next to the distribution of event counts, but I can show you a (convoluted) way to get the events grouped and displayed as you require.
First add a new table to your model, called Events
Events
0 Events
1 Event
2 Events
3+ EventsThen create a calculated table to contain the summarized data, along with some concatenation work.
DeviceSummary = SUMMARIZE ( Devices, Devices[F_ID], Devices[D_ID], "Event Count", CONCATENATE ( //This is basically if nothing, give 0, if 1 or 2 give the number, if > 3 give 3+ IF ( ISBLANK ( CALCULATE ( COUNT ( Devices[CaseID] ), FILTER ( Devices, Devices[Event_Date] > Devices[Service_Date] ) ) ), 0, IF ( CALCULATE ( COUNT ( Devices[CaseID] ), FILTER ( Devices, Devices[Event_Date] > Devices[Service_Date] ) ) < 3, CALCULATE ( COUNT ( Devices[CaseID] ), FILTER ( Devices, Devices[Event_Date] > Devices[Service_Date] ) ), "3+" ) ), " Events" ), "Device ID", CONCATENATE ( Devices[F_ID], CONCATENATE ( "-", Devices[D_ID] ) ) )Go into your model and link Events[Events] with DeviceSummary[Event Count].
Finally, make a column chart with Events[Events] as the X-axis and DeviceSummary[Device ID] as the value (it will default to count). On the dropdown for Events, choose "Show items with no data". Sort the visual by Events ascending and voila.
You can apply slicers on F_ID and/or D_ID to this visual and it will react accordingly, since we have those values in the summary table.
Hope this helps
David
Hi @f_young2018
I don't think you can do your full scenario with the total number of devices next to the distribution of event counts, but I can show you a (convoluted) way to get the events grouped and displayed as you require.
First add a new table to your model, called Events
Events
0 Events
1 Event
2 Events
3+ Events
Then create a calculated table to contain the summarized data, along with some concatenation work.
DeviceSummary =
SUMMARIZE (
Devices,
Devices[F_ID],
Devices[D_ID],
"Event Count", CONCATENATE ( //This is basically if nothing, give 0, if 1 or 2 give the number, if > 3 give 3+
IF (
ISBLANK (
CALCULATE (
COUNT ( Devices[CaseID] ),
FILTER ( Devices, Devices[Event_Date] > Devices[Service_Date] )
)
),
0,
IF (
CALCULATE (
COUNT ( Devices[CaseID] ),
FILTER ( Devices, Devices[Event_Date] > Devices[Service_Date] )
)
< 3,
CALCULATE (
COUNT ( Devices[CaseID] ),
FILTER ( Devices, Devices[Event_Date] > Devices[Service_Date] )
),
"3+"
)
),
" Events"
),
"Device ID", CONCATENATE ( Devices[F_ID], CONCATENATE ( "-", Devices[D_ID] ) )
)Go into your model and link Events[Events] with DeviceSummary[Event Count].
Finally, make a column chart with Events[Events] as the X-axis and DeviceSummary[Device ID] as the value (it will default to count). On the dropdown for Events, choose "Show items with no data". Sort the visual by Events ascending and voila.
You can apply slicers on F_ID and/or D_ID to this visual and it will react accordingly, since we have those values in the summary table.
Hope this helps
David
Hi David, thank you so much!!