Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
filarap
Helper III
Helper III

Create histogram out of id count

Hi all,

 

I need help with creation of dynamic histogram.

 

I have a table with one columns being Case ids, that can appear multiple times.

I need to create a column chart with x axis showing, 0,1,2,3,4..... which represent how many times case id appears in a table, and y axis showing how many distinct Case ids are in that category? 

 

I have tried summarise and groupby daax, but nothing i tried worked.

Example of what i have:

Case Id
123
234
345
456
123
123
345

 

Example of what i am trying to achieve:

Count CategoryNumber of distinct cases
12
21
31

 

PLease assist

Thank you

Filarap

1 ACCEPTED SOLUTION
SteveCampbell
Memorable Member
Memorable Member

There is a custom visual called Histogram, available in the store.

 


Otherwise, if you don't want to use a custom visual:

(Edit from my last answer to make dynamic:)

Create this table:

Hist = GENERATESERIES(1,100,1)

 

Then this measure:

Histogram Values = 
var _table= ADDCOLUMNS(VALUES('Table'[Column1]),"CountValue",CALCULATE(COUNT('Table'[Column1])))

var _selected = SELECTEDVALUE(Hist[Value])

RETURN 
COUNTX(FILTER(_table,[CountValue]=_selected),[CountValue])

Change 'Table'[Column1] to your Column.

Now make a column chart and use Hist[Value] in the axis, and the measure [Histogram Values] in values.

 

 

 

Love hearing about Power BI tips, jobs and news?
I love to share about these - connect with me!

Stay up to date on  linkedin-logo.png
Read my blogs on  powerbi.tips_.png

Remember to spread knowledge in the community when you can! tu.png



Did I answer your question? Mark my post as a solution! Proud to be a Super User!


Connect with me!
Stay up to date on  
Read my blogs on  



View solution in original post

1 REPLY 1
SteveCampbell
Memorable Member
Memorable Member

There is a custom visual called Histogram, available in the store.

 


Otherwise, if you don't want to use a custom visual:

(Edit from my last answer to make dynamic:)

Create this table:

Hist = GENERATESERIES(1,100,1)

 

Then this measure:

Histogram Values = 
var _table= ADDCOLUMNS(VALUES('Table'[Column1]),"CountValue",CALCULATE(COUNT('Table'[Column1])))

var _selected = SELECTEDVALUE(Hist[Value])

RETURN 
COUNTX(FILTER(_table,[CountValue]=_selected),[CountValue])

Change 'Table'[Column1] to your Column.

Now make a column chart and use Hist[Value] in the axis, and the measure [Histogram Values] in values.

 

 

 

Love hearing about Power BI tips, jobs and news?
I love to share about these - connect with me!

Stay up to date on  linkedin-logo.png
Read my blogs on  powerbi.tips_.png

Remember to spread knowledge in the community when you can! tu.png



Did I answer your question? Mark my post as a solution! Proud to be a Super User!


Connect with me!
Stay up to date on  
Read my blogs on  



Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.