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.
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:
PlayerId | Points |
1 | 30 |
Players:
PlayerId | Name |
1 | John 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.
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.
@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
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
46 | |
28 | |
22 | |
12 | |
8 |
User | Count |
---|---|
76 | |
53 | |
46 | |
16 | |
12 |