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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Pan_Forex
Helper III
Helper III

Average from 2 tables

Hi guys, I would like to count the average in each game depending on which players were in it. I have 2 tables connected by a one-to-many relationship. They look like this:

 

IDPlayer
1A
1B
1C
1D
2D
2C
2E
2F
3A
3G
3B
3C
3D
3E

 

Player  Score
A5
B6
C5,5
D7
E6,2
F6,8
G4,5

For example, the average for game ID[1]=(5+6+5,5+7)/4=5.875

1 ACCEPTED SOLUTION

Hi, @Pan_Forex 

 

You can try the following methods.

Column:

Score = LOOKUPVALUE(Score[Score],Score[Player],[Player])

vzhangti_0-1673504561344.png

Measure:

Measure = CALCULATE(AVERAGE(Player[Score]),ALLEXCEPT(Player,Player[ID]))

vzhangti_1-1673504593541.png

Measure 2 = 
VAR _table = CALCULATETABLE(VALUES('Player'[ID]),FILTER(ALL('Player'),'Player'[Player]=SELECTEDVALUE(Player[Player])))
RETURN
CALCULATE(AVERAGE(Player[Score]),FILTER(ALL(Player),[ID] in _table))

vzhangti_2-1673504625471.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

 

View solution in original post

5 REPLIES 5
Pan_Forex
Helper III
Helper III

It works, thank you very much. I have one more comment. What if I would like to count the average score of the players in each game but only if the player was in it. Currently if I add the player and avg score measure to the table, I get the individual average of each player, not the average of the games he participated in.

Hi,

Thank you for your message.

May I ask what is the expected number that you want to see for each player?


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Sure, here we go: 

Player A- 5,77 

Player B- 5,77

Player C- 5,82

 

 

Hi, @Pan_Forex 

 

You can try the following methods.

Column:

Score = LOOKUPVALUE(Score[Score],Score[Player],[Player])

vzhangti_0-1673504561344.png

Measure:

Measure = CALCULATE(AVERAGE(Player[Score]),ALLEXCEPT(Player,Player[ID]))

vzhangti_1-1673504593541.png

Measure 2 = 
VAR _table = CALCULATETABLE(VALUES('Player'[ID]),FILTER(ALL('Player'),'Player'[Player]=SELECTEDVALUE(Player[Player])))
RETURN
CALCULATE(AVERAGE(Player[Score]),FILTER(ALL(Player),[ID] in _table))

vzhangti_2-1673504625471.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

 

Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

Jihwan_Kim_0-1673451986750.png

 

Jihwan_Kim_1-1673452243215.png

 

 

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.