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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

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])

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.