The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
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.
@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
User | Count |
---|---|
15 | |
11 | |
8 | |
8 | |
7 |
User | Count |
---|---|
21 | |
20 | |
11 | |
10 | |
7 |