Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
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?
Solved! Go to Solution.
@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! 😀
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
Dear @Anonymous
Wait I'll make a pbix and send you here .
Give me some time
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
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! 😀
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! 😀
Hi, what is the DAX for this?
=AVERAGE(Year) ??
Also is this measure my new legend?
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 97 | |
| 74 | |
| 50 | |
| 48 | |
| 46 |