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
jakseadog
New Member

Value from related table

Hello,

 

I'm learning DAX and I'm stuck with finding one solution. Let's consider following easy example:

 

I have 2 tables: one called Statistics and one called Players (many to one relationship).

 

Statistics:

 

PlayerIdPoints
1

30

 

Players:

 

PlayerIdName
1John Doe

 

30 points is the highest value - I can get it using MAX function. I can also get PlayerId who scored this max amount of points. But how can I get his Name - John Doe?

To sum up - I would like to know how to write DAX query, which would return name of player, who scored most points.

4 REPLIES 4
Jihwan_Kim
Super User
Super User

Hi, @jakseadog 

Please correct me if I wrongly understood your question.

 

Please try to create the below measure.

 

measure = calculate (selectedvalue(Players[name]), [PlayerID] = yourmeasurethat indicatesMAXscorePlayerID)

 

Hi, My name is Jihwan Kim.

If this post helps, then please consider accept it as the solution to help other members find it faster.

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.


Go to My LinkedIn Page


amitchandak
Super User
Super User

@jakseadog , In Statistics, You can create new column

Player Name= related(Players[Name])

 


refer 4 ways to copy data from one table to another
https://www.youtube.com/watch?v=Wu1mWxR23jU
https://www.youtube.com/watch?v=czNHt7UXIe8

 

Thank you for response. But what if I would like to keep my model as star schema and not replicate player name in Statistics, but keep it only in Players table? Is there any way to show this value as a measure for example?

@jakseadog , As they are joined you can always use the player name with Fact Statistics in table visual

or you can use Max(Players[Name]) as measure if needed

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