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
Lucas_LP
Frequent Visitor

Slicer, filter a bar chart by average of column (percentage column)

Hi,

 

I am having trouble filtering a Bar chart with a slicer by average percentages.

The idea is that the Bar chart show the average percentage of something for certain people. I was asked to add a slicer that would filter it so the user can select what range of percentages it want to see. A slicer of the column with percentages will take out percentages and therefore change the average percentage (which is what i want to filter out).

 

I tried making a table grouped by person and adding the percentage column average. But this will not work as i need to then have slicers to see data by year, month, zone, etc. So i would need to create way too many columns in a really complicated manner to be able to do it like that.

Any other or easy method? I feel like it should be way easier than how im finding it to be. Currently im trying to create some sort of Dax measure that i can put in the bar chart but that at the same time connect to a slicer that goes from 0% to 100%.

 

Screenshot 2022-10-18 105842.png

 

Upwards a small example of the slicer and chart in question.

Thanks in advance!

1 ACCEPTED SOLUTION

Hi, i was just able to solve it.

I made a Parameter (lets call it "Param") that went from 0% to 100% (could be a table with one column as well). The parameter itself is like a slicer.
Then i created a measure: IF( AVERAGE(Name)<=MAX(Param) && AVERAGE(Name)>=MIN(Param),1,0)
Then i filtered the chart by the values of the measure equal to "1".

That way it works perfectly, with all the other slicers i want or could need to add on the future.

 

Still many thanks for the quick response. Im not sure if it would work on my specific case (do to the other slicers/filters) but i see the logic itself is quite similar.

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Lucas_LP , Assume you axis column is group  and measure used is M1

 

Create a measure like

=

var _min = minx(allselected(slicer), slicer[Value])

var _max = maxx(allselected(slicer), slicer[Value])

return

calculate([M1], filter(Values(Table[Group]), [M1] >= _min && [M2] <= _Max))

Hi, i was just able to solve it.

I made a Parameter (lets call it "Param") that went from 0% to 100% (could be a table with one column as well). The parameter itself is like a slicer.
Then i created a measure: IF( AVERAGE(Name)<=MAX(Param) && AVERAGE(Name)>=MIN(Param),1,0)
Then i filtered the chart by the values of the measure equal to "1".

That way it works perfectly, with all the other slicers i want or could need to add on the future.

 

Still many thanks for the quick response. Im not sure if it would work on my specific case (do to the other slicers/filters) but i see the logic itself is quite similar.

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.