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

Taking an average of slicer inputs.

Hi, I am very new to Power BI so I hope someone can help.

I have a barchart which gives an indicator by country, and a slicer which filters this by year.

When you select 2 years, two bars appear per country.

I need this to change so that selecting multiple years creates an average, i.e. one bar per country representing an average of the slicer.

 

What is the best way to achieve this?

2 ACCEPTED SOLUTIONS

@Anonymous ,

If you get additional bars after selecting two or more years, you probably have the Year field added to the legend.
Delete the field from the Legend, and then update the value in the Value field.


1. If you are using a regular column, click the arrow next to the column and select Average.
2. If you are using a measure, add the Average function to your code.

In this case, if you choose one year it will show you the normal value, if you choose more years you will get the average.

 

Please find an example: https://filebin.net/q5juxa6gh3jrx6zs 



_______________
If I helped, please accept the solution and give kudos! 😀

View solution in original post

Dear @Anonymous ,
here is your solution.
The measure "Average"  is your solution

here is your pbix  - https://drive.google.com/file/d/138t0BpZnl18hysY8yFHOVXJh50uOXfOG/view?usp=sharing

and here is raw data excel which i used - https://drive.google.com/file/d/1x0L5sx_RnUg5BQzBh1kMl7WXFi1fIiYb/view?usp=sharing


Please give kudos to all my post  to m keep me motivated  
and if it helped please accept as solution

if any doubt please let me know 

regards 

Thakur Sujit

View solution in original post

7 REPLIES 7
Sujit_Thakur
Solution Sage
Solution Sage

Dear @Anonymous 

Wait I'll make a pbix and send you here .

Give me some time 

Anonymous
Not applicable

Thank you

Dear @Anonymous ,
here is your solution.
The measure "Average"  is your solution

here is your pbix  - https://drive.google.com/file/d/138t0BpZnl18hysY8yFHOVXJh50uOXfOG/view?usp=sharing

and here is raw data excel which i used - https://drive.google.com/file/d/1x0L5sx_RnUg5BQzBh1kMl7WXFi1fIiYb/view?usp=sharing


Please give kudos to all my post  to m keep me motivated  
and if it helped please accept as solution

if any doubt please let me know 

regards 

Thakur Sujit

lkalawski
Super User
Super User

Hi @Anonymous ,

 

Could you please provide an example of the data and whether you are using measures or columns in the visualization? If you can upload a sample file it will speed up help.

 

Here you can use the option built into the PBI to show averages, you can also write a measure that will show the average if more than one year is selected.



_______________
If I helped, please accept the solution and give kudos! 😀

Anonymous
Not applicable

Hi, I'm not authorised to share the data and it is too extensive/layered to produce a sample.

 

I am using measures, could you explain how to write the new measure the conditional average?

@Anonymous ,

If you get additional bars after selecting two or more years, you probably have the Year field added to the legend.
Delete the field from the Legend, and then update the value in the Value field.


1. If you are using a regular column, click the arrow next to the column and select Average.
2. If you are using a measure, add the Average function to your code.

In this case, if you choose one year it will show you the normal value, if you choose more years you will get the average.

 

Please find an example: https://filebin.net/q5juxa6gh3jrx6zs 



_______________
If I helped, please accept the solution and give kudos! 😀

Anonymous
Not applicable

Hi, what is the DAX for this?

 

=AVERAGE(Year) ??

 

Also is this measure my new legend?

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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