Categories: Power BI
Tags:

Our model that we create in Part 1 of this project, is already strong enough to calculate batsman performance accurately. Below are the exact DAX measures and setup you need for:

  1. Top run scorers per season
  2. Batting average per season
  3. Most sixes & most boundaries
  4. Strike rate of top 10 batsmen

All formulas assume these columns exist in ball_by_ball_data (adjust names if slightly different):

  • match_id
  • batter or batsman
  • batter_runs or batsman_runs
  • ball_number
  • is_four (optional)
  • is_six (optional)

And this relationship is active:
ball_by_ball_data[match_id] → ipl_matches_data[match_id]


1. TOTAL RUNS BY BATSMAN (BASE MEASURE)

Create this first — everything else depends on it.

Total Runs =
SUM(ball_by_ball_data[batter_runs])

Use this with:

  • Axis → batter
  • Values → Total Runs
  • Filter → Top N (Top 10 by Total Runs)

This gives you Top Run Scorers.


2. TOTAL RUNS PER SEASON (FOR SEASON-WISE ANALYSIS)

Because season is in ipl_matches_data, relationship will propagate automatically:

Season Runs =
CALCULATE(
    [Total Runs],
    ALLEXCEPT(
        ipl_matches_data,
        ipl_matches_data[season]
    )
)

For Top Scorers Per Season, use:

  • Axis → batter
  • Legend → season
  • Values → Total Runs
  • Visual Filter → Top N (10 by Total Runs)

3. BALLS FACED BY BATSMAN

This is required for average and strike rate.

Balls Faced =
COUNTROWS(
    FILTER(
        ball_by_ball_data,
        ball_by_ball_data[batter_runs] >= 0
    )
)

4. DISMISSALS (OUT COUNT)

If you have player_dismissed column:

Times Out =
COUNTROWS(
    FILTER(
        ball_by_ball_data,
        NOT ISBLANK(ball_by_ball_data[player_dismissed])
            && ball_by_ball_data[player_dismissed] = SELECTEDVALUE(ball_by_ball_data[batter])
    )
)

If you do not have dismissal data, tell me — I’ll give you an alternate safely.


5. BATTING AVERAGE PER SEASON

Batting Average =
DIVIDE(
    [Total Runs],
    [Times Out],
    0
)

Use this in a table with:

  • season
  • batter
  • Batting Average

Add a Top N filter if needed.


6. TOTAL SIXES

If is_six column exists:

Total Sixes =
SUM(ball_by_ball_data[is_six])

If not, use run-based detection:

Total Sixes =
COUNTROWS(
    FILTER(
        ball_by_ball_data,
        ball_by_ball_data[batter_runs] = 6
    )
)

7. TOTAL BOUNDARIES (4s + 6s)

Total Boundaries =
COUNTROWS(
    FILTER(
        ball_by_ball_data,
        ball_by_ball_data[batter_runs] = 4
            || ball_by_ball_data[batter_runs] = 6
    )
)

8. STRIKE RATE (CRITICAL METRIC)

Strike Rate = (Runs / Balls) × 100

Strike Rate =
DIVIDE(
    [Total Runs],
    [Balls Faced],
    0
) * 100

9. TOP 10 BATSMEN BY STRIKE RATE (PROPER METHOD)

  1. Create a table visual:
    • Rows → batter
    • Values → Strike Rate, Total Runs, Balls Faced
  2. Add a visual-level filter:
    • Filter on batter
    • Set Top N → 10
    • By value → Total Runs
    • Apply filter

This ensures:

  • You do NOT get random tailenders
  • Only genuine top run getters by strike rate appear

10. MOST SIXES PER SEASON (VISUAL READY)

Use:

  • Axis → season
  • Values → Total Sixes
  • Legend → batter
  • Filter → Top N = 5 by Total Sixes

11. MOST BOUNDARIES PER SEASON

Use:

  • Axis → season
  • Values → Total Boundaries
  • Legend → batter

12. OPTIONAL – PERFORMANCE SUMMARY TABLE

Use this in one table visual:

Column
batter
Total Runs
Balls Faced
Strike Rate
Total Sixes
Total Boundaries
Batting Average

This becomes your Master Batsman Performance Table.


13. DATA QUALITY SAFETY (VERY IMPORTANT)

If you see inflated strike rates:

  • Exclude extras-only deliveries if column exists:
Balls Faced =
COUNTROWS(
    FILTER(
        ball_by_ball_data,
        ball_by_ball_data[extras] = 0
    )
)

Tell me if you want this refined.


14. FINAL KPI CARDS YOU CAN ADD

  • Highest Individual Total Runs:
Max Runs by Batsman =
MAXX(
    VALUES(ball_by_ball_data[batter]),
    [Total Runs]
)
  • Best Strike Rate:
Best Strike Rate =
MAXX(
    VALUES(ball_by_ball_data[batter]),
    [Strike Rate]
)