Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
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. 😊
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 5 | |
| 5 | |
| 4 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 24 | |
| 21 | |
| 12 | |
| 11 | |
| 10 |