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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Histogram with dynamic axis

Hi PBI Community,

 

I am trying to build a report that uses a histogram to show the distribution in occupancy and I need help. Pbix below

 

https://www.dropbox.com/s/xzq95otm3ki14b2/Histogram%20question.pbix?dl=0

 

In the example, I am trying to show visuals for occupancy = number of guests / number of rooms. In the table, you can see how the occupancy breaks down by building (north or south) and category (a or b, indicating whether it's a suite or a regular room). To calculate aggregate occupancies, I need do a summation of the census and beds based on the slicers. It is not accurate to average occupancies accross buildings and categories. 

 

Here is my problem: In the histogram, I need to enter a calculated column as my axis. In doing so, I am unable to filter the histogram for buildings and categories without getting an inaccurate graph.

 

Anyone have any methods to make the histogram axis dynamic based on the selected slicers?

 

Thanks for your help!

 

 

1 ACCEPTED SOLUTION

Hi,

 

After a lot test, i find it.

Please try to create a table first as below:

X-Axis = GENERATESERIES(0,1,0.01)

Then create a measure:

Measure Value = COUNTROWS(FILTER(SUMMARIZE('Census','Census'[Date],"AVG",ROUND([Average Occupancy],2) ),[AVG] = ROUND(SELECTEDVALUE('X-Axis'[Value]),2)))

When you select all in two slicers, it shows as my original reply:

10.PNG

When you select North only in Building slicer, the x-axis has dynamically changed:

11.PNG

Here is my test pbix file:

pbix 

If i have solved your issue, please mark my answer as a solution for others to see.

Thanks!

 

Best Regards,

Giotto Zhi

View solution in original post

8 REPLIES 8
v-gizhi-msft
Community Support
Community Support

Hi,

 

Please try this measure to replace the original Count of Date value:

Measure = CALCULATE(COUNTROWS(Census),FILTER(Census,Census[Building]=SELECTEDVALUE(Census[Building])&&Census[Category]=SELECTEDVALUE(Census[Category])))

When you choose the slicer, the result shows:

21.PNG 

Hope this helps.

 

Best Regards,

Giotto Zhi

Anonymous
Not applicable

Thanks for your suggestion!

 

I tried the measure and it's still not quite giving me what I need. 

 

Here is a revised pbix file: https://www.dropbox.com/s/xzq95otm3ki14b2/Histogram%20question.pbix?dl=0 

 

All the filters and slicers will impact the table visual. I would like the histogram to represent the data in the total column of that table. So in the example here, there should only be seven values in the histogram:

1 74%

1 75%

1 77%

3 82%

1 83%

I hope that's a better explanation of the problem. Thanks again for your help!

 

 

Hi,

 

Please try to create this calculated table first:

Table = SUMMARIZE(Census,Census[Date],"Column",[Average Occupancy])

Then create a measure to count date:

Measure 2 = DISTINCTCOUNT(Census[Date])

The result shows:

10.PNG11.PNG

Here is the changed pbix file:

pbix 

Hope this helps.

 

Best Regards,

Giotto Zhi

Anonymous
Not applicable

Thanks! This is really close. 

 

The histogram in the file does represent the table as is, but if I apply any filters (e.g., just looking at the north building) then the histogram does not change. Any idea on how to enable that functionality?

 

Thanks again - I really appreciate your thoughts!

Hi,

 

After a lot test, i find it.

Please try to create a table first as below:

X-Axis = GENERATESERIES(0,1,0.01)

Then create a measure:

Measure Value = COUNTROWS(FILTER(SUMMARIZE('Census','Census'[Date],"AVG",ROUND([Average Occupancy],2) ),[AVG] = ROUND(SELECTEDVALUE('X-Axis'[Value]),2)))

When you select all in two slicers, it shows as my original reply:

10.PNG

When you select North only in Building slicer, the x-axis has dynamically changed:

11.PNG

Here is my test pbix file:

pbix 

If i have solved your issue, please mark my answer as a solution for others to see.

Thanks!

 

Best Regards,

Giotto Zhi

Anonymous
Not applicable

It worked! Thank you so much - you're amazing!

Anonymous
Not applicable

Capture.PNG

Greg_Deckler
Community Champion
Community Champion

Will see if I can take a look at the PBIX. But, in general, I think some variation of the Disconnected Table Trick? https://community.powerbi.com/t5/Community-Blog/Solving-Attendance-with-the-Disconnected-Table-Trick...



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors