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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
mg-66
Regular Visitor

Calculate Average from highest X values

Hello everyone,

I am new to Power BI and could need your help.

 

I have a Dataset that consistes of many tables and looks now like this:

DateTemp......
.....105,2.....
.....103,3.....
.....

98,7

.....
.....99,1.....
.....101,5.....
.....99,8.....

 

The other columns should be irrelevant for now. The Time at which these measures where taken doesn't play a role for me.

I wand to add a measure to calculate the average of my 2 highest Temp. values.

Maybe we can order this Column in a descending order and choose the top values to build then the average from them.

 

Thanks for your help and explanation.

Best Regards

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@mg-66 , Create a column Rank

 

R1= Rankx(Table, [Temp],,desc, dense)

 

Then create a measure

 

Averagex(filter(Table, Table[R1]<=2), Table[Temp])

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@mg-66 , Create a column Rank

 

R1= Rankx(Table, [Temp],,desc, dense)

 

Then create a measure

 

Averagex(filter(Table, Table[R1]<=2), Table[Temp])

@amitchandak thanks alot, it works now 😀.

I would like to add something.

I want to do the same, but sort the Temp. according to their day and to their Starting Time (ST). Like in this table for example:

DaySTTempRank
18am105,21
18am103,32
18am

98,7

3
110am99,13
110am101,51
110am99,82
28am105,41
28am100,32
28am96,73
210am97,72
210am98,81

Then I will calculate the average in the same way by clicking the Day & Starting Time (ST) Slicer/Filter in the report.

@amitchandak thank you for your Answer again. But this approach is not working. I also can not tell why or whats mistake I'm doing maybe.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.