Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I'd like some help summarizing baseball statistics utilizing a DAX expression to help me find the following
GP | PA | AB | H | 2B | 3B | HR | RBI | R | BB | SO | Name |
1 | 2 | 2 | 2 | 2 | 0 | 0 | 2 | 1 | 0 | 0 | Player 1 |
1 | 2 | 2 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | Player 2 |
1 | 2 | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | Player 3 |
2 | 2 | 1 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | Player 1 |
2 | 2 | 2 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | Player 2 |
2 | 2 | 2 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | Player 3 |
3 | 3 | 2 | 2 | 0 | 0 | 0 | 2 | 2 | 1 | 0 | Player 1 |
3 | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | Player 2 |
3 | 2 | 2 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | Player 3 |
4 | 2 | 2 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | Player 1 |
4 | 2 | 2 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | Player 2 |
4 | 1 | 1 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | Player 3 |
5 | 3 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 3 | 0 | Player 1 |
5 | 3 | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | Player 2 |
5 | 2 | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | Player 3 |
6 | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | Player 1 |
6 | 2 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | Player 2 |
6 | 2 | 2 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | Player 3 |
7 | 3 | 2 | 1 | 0 | 1 | 0 | 2 | 2 | 0 | 1 | Player 1 |
7 | 3 | 1 | 1 | 0 | 0 | 0 | 0 | 2 | 1 | 0 | Player 2 |
7 | 3 | 2 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | Player 3 |
To find the number of hits (H) and at-bats (AB) for each player in the last 1, 3, and 5 games, you can use the following DAX expressions:
These expressions use the CALCULATE, SUM, FILTER, ALL, and MAX functions to calculate the total number of hits and at-bats for each player in the specified number of games. You can learn more about these functions from the DAX reference.
You can use a similar approach to find other statistics such as RBI, PA, etc. For example, to find the RBI last 3 games, you can use:
I hope this helps you with your baseball analysis. If you have any other questions, please feel free to ask. 😊
User | Count |
---|---|
25 | |
12 | |
8 | |
6 | |
6 |
User | Count |
---|---|
26 | |
12 | |
11 | |
10 | |
6 |