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

Best 6/8-Year Average

Hello,

 

I have columns for 2022 Production, 2021 Production, 2020 Production, 2019 Production, 2018 Production, 2017 Production, 2016 Production, and 2015 Production. I would like to add a column to the table for the best 6/8-year average (average of max 6 years).

 

I have been able to create the best 6/7-year average by subtracting the minimum, but I'm not sure if I'm able to have 2 minimums. Please let me know how to do this or if there is a better way to do this.

 

Thanks,

Kristen

4 REPLIES 4
v-tangjie-msft
Community Support
Community Support

Hi @kristenmcnelly ,

 

According to your description, you want to calculate the best 6/8 average, right? Here are my steps you can follow as a solution.

(1)This is my test data.

vtangjiemsft_0-1667292898537.png

(2)Click “Home” ->” Transform data”.

Sort the [Production] column in descending order.

vtangjiemsft_1-1667292898542.png

(3) Add an index column.

vtangjiemsft_2-1667292898543.png

 

vtangjiemsft_3-1667292898545.png

(4) We can create  a measure.

Measure = CALCULATE(SUM('Table'[Production]),FILTER(ALL('Table'),'Table'[Index]>=1 && 'Table'[Index]<=6))/8

(5) Then the result is as follows.

vtangjiemsft_4-1667292898546.png

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

My data is formatted as the production for each year as the columns and multiple rows of people, so I don't think it will work the same way.

amitchandak
Super User
Super User

@kristenmcnelly ,

New Column=

var _table = {[2022 Production], [2021 Production], [2020 Production], [2019 Production], [2018 Production], [2017 Production], [2016 Production]}

var _add = addcolumn(_table, "Rank", Rankx(_table, [Value],,asc,dense)

return

averageX(filter(_table, [Rank]>1), [Value])

Thank you for your response! I'm not sure what [Value] should be. I suspect it should be Production, but Production is broken down by year, it is not one field.

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.

Top Solution Authors