Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi Everyone, thanks in advance for your kind support.
I'm fairly new to PBI, and trying to figure out the following:
- working with NBA statistics for Michael Jordan, I want to COUNT the number of titles he has won.
- the data table I have lists all statistics (pts, fg, playoff_stage,game id, w_or_l etc)
- I have created measures to count the total number of games, total W or total L.
- Now I'm stuck in evaluating with a measure or other way how many titles MJ has won (the result if 6 out of 6 participations in NBA finals).
season id | wins | losses | total games in final |
7 | 4 | 1 | 5 |
8 | 4 | 2 | 6 |
9 | 4 | 2 | 6 |
11 | 4 | 2 | 6 |
12 | 4 | 2 | 6 |
13 | 4 | 2 | 6 |
The above is thre resulting visual matrix created in PBI adding the relevant fields:
Season_id is the nth season MJ played in NBA (values store in a lookup table with relationship to the fact/data table).
Wins, Losses and total games in final, are measures calculated from a data table
e.g. Wins :=
Since we know that 4W = Nba champ, I'd like to count that automatically, as I want to add also statistics for other players and make some comparisons among them.
If I have not made myself clear, I apologise and will try to clarify.
Happy sunday to all of you.
Solved! Go to Solution.
The basic concept would be to iterate over seasons and count when wins = 4.
ChampSeasons =
COUNTROWS (
FILTER (
VALUES ( jordan_playoffs[season] ),
[Wins] = 4
)
)
Thank you Alexis, it was easier than expected. Inserted into my files and checked.
Will review the logic behind the piece of code to reuse it in other events.
The basic concept would be to iterate over seasons and count when wins = 4.
ChampSeasons =
COUNTROWS (
FILTER (
VALUES ( jordan_playoffs[season] ),
[Wins] = 4
)
)
User | Count |
---|---|
84 | |
76 | |
74 | |
48 | |
39 |
User | Count |
---|---|
114 | |
56 | |
51 | |
42 | |
42 |