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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Histogram based on measure values

Hi, 

I`m trying to build a Histogram (Column Chart) that shows the following:
x-axis: Bins based on Sum earnings for each Simulation
y-axis: Count of those simulations 

Here is sample data:

Asset ScenarioFYSimulation NumberEarnings
2203015075934
22031114049834
12030143520733
12031176475741
22030252532894
22031252761483
12030242437395
1203129337237
12030354247547
12031390341398
22030371665715
22031347382286
12030460142877
12031463004168
22030455178590
22031428560290
12030560202994
12031540427671
22030545617474
22031598480761


I was able to create a Column Chart BUT based on a column for the x-axis which is not subject to slicers (I will be using Asset Scenario & FY as slicers)

KK92_0-1686212642498.png

The chart is also based on the full data, won`t match the sample data provided.

Any way I can build this? 
I think I`ll need to:
1. Write a measure that returns the sum of earnings for each simulation number
2. Build Bins based on that
3. Be able to use those bins for x-axis
But I`m not sure how to establish those



1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Many thanks @Ashish_Mathur  for your help, this has solved the challenge for me. 

For future readers, I had to change a few things to customise the provided solution to my case: 
1. Removed legend
2. Expanded the bins table to match ranges of my actual data and desired bin size
3.a Created measure [E2] = DistinctCount(Simulation number) as I was looking to show that instead of measure [E]= Sum(Earnings)
3.b adjusted the provided [E by bins] based on previous point, still needed to use [E] and the formula became like this: 
E by bins = CALCULATE([E2],FILTER(ADDCOLUMNS(VALUES(Data[Simulation Number]),"ABCD",CALCULATE([E],CALCULATETABLE(VALUES(Data[Simulation Number])))),COUNTROWS(FILTER(Bins,[ABCD] >= Bins[Lower] && [ABCD] <= Bins[Upper])) >0))
4. For those interested in maintaining a continuos x-axis, I have created a new numeric column showing the midpoint of the bins (on the Bins table) and used that on the x-axis instead of bin names. 
I had a need to use x-axis constant lines. 

Here is my replication of the provided solution. 

KK92_0-1686582322967.png

 

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
lbendlin
Super User
Super User

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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