Categories: Power BI
Tags:

The Indian Premier League (IPL) is more than just a cricket tournament—it’s a goldmine of data, trends, and performance insights. From nail-biting finishes to record-breaking seasons, the IPL has delivered unforgettable moments since 2008. To transform this rich history into meaningful visual insights, Ankit Srivastava, Lead Trainer at Slidescope, has created a powerful and interactive Power BI dashboard titled:

“IPL 2008 – 2025 Season Wise Highlights – Part 1”

This tutorial is designed to help data enthusiasts, Power BI learners, and sports analytics fans understand how real-world sports data can be modeled and visualized effectively.

Get the Dataset here: https://www.kaggle.com/datasets/slidescope/ipl-seasons-2008-to-2025-dataset/data?select=all_ball_by_ball_data.csv


📊 What This Power BI Dashboard Covers

This dashboard delivers a season-wise analytical overview of IPL from 2008 to 2025, focusing on key performance indicators and match-level trends. Some of the major insights include:

✅ Matches Played Per Season

A horizontal bar chart highlights how the total number of matches has varied across different IPL seasons—from shorter seasons to high-volume editions like 2013, 2022, and 2023.

✅ Season-Wise Match Winners

This table clearly showcases:

  • IPL season
  • Final match winner
  • Champion team name
    It instantly reveals the dominance of teams like Chennai Super Kings, Mumbai Indians, and Kolkata Knight Riders.

✅ 4s and 6s by Season

A comparative bar chart tracks the explosive growth in boundary-hitting over the years, highlighting:

  • Rise in aggressive batting
  • Impact of rule changes and pitch conditions
  • Evolution of T20 gameplay

✅ Total Runs Scored Per Season

A dedicated visual breaks down the sum of total runs by each season, showing how scoring rates have steadily increased over the years.


📍 KPI Cards at a Glance

The dashboard also features smart KPI cards for quick summary insights:

  • 🔹 46.37K Overs Bowled
  • 🔹 278K Total Balls Delivered
  • 🔹 18 IPL Seasons Covered
  • 🔹 1169 Total Matches Analyzed

These figures make it clear just how massive the IPL dataset truly is.


🧠 Learning Outcomes from This Tutorial

With this tutorial, learners can understand:

  • ✅ How to build season-wise aggregation models
  • ✅ Handling multiple relationships in Power BI
  • ✅ Creating Winner & Losing Team columns using DAX
  • ✅ Using conditional logic for match outcomes
  • ✅ Structuring sports analytics dashboards
  • ✅ Designing high-impact KPI visualizations

This project is especially useful for:

  • Power BI beginners
  • Data analytics students
  • Sports analytics professionals
  • Dashboard designers

Below is a precise, step-by-step Power BI tutorial in points that walks you from opening Power BI Desktop through loading the five CSVs, building a correct model, and creating the key calculated columns and measures (with exact DAX). Use the file names you showed: all_ball_by_ball_data.csv, all_ipl_matches_data.csv, all_players-data-updated.csv, all_team_aliases.csv, all_teams_data.csv. If a column name in your files differs slightly, substitute the exact name in the DAX shown.


1. Opening Power BI Desktop

  1. Launch Power BI Desktop.
  2. Create a new file (File → New) or open your project file if you already started.
  3. Save the file immediately (File → Save As) and choose a project folder so you don’t lose changes.

2. Loading the five tables (Get Data → CSV)

  1. In Home ribbon click Get data → Text/CSV.
  2. Load each CSV one by one in this order:
    • all_teams_data.csv → table name: all_teams_data
    • all_team_aliases.csv → table name: all_team_aliases
    • all_players-data-updated.csv → table name: all_players_data
    • all_ipl_matches_data.csv → table name: all_ipl_matches_data
    • all_ball_by_ball_data.csv → table name: all_ball_by_ball_data
  3. For each CSV, click Transform Data (Power Query editor) before loading so you can sanitize types and names.

3. Power Query: basic cleansing and preparation (do this for every table)

  1. Set data types: Date columns → Date, numeric IDs → Whole Number, text columns → Text.
  2. Trim / Clean: Select text columns → Transform → Format → Trim and Clean to remove stray spaces.
  3. Rename columns to consistent names if necessary (e.g., team_id, team_name, match_id, team1, team2, match_winner, batsman_runs, is_four, is_six).
  4. Remove duplicate rows where appropriate (Home → Remove Rows → Remove Duplicates).
  5. Filter out null/blank rows in key columns (filter out rows where match_id is null).
  6. Unpivot only when necessary—don’t unpivot match or ball-by-ball data.
  7. Close & Apply to load cleaned tables to the model.

4. Optional: Normalize team names via alias table

  1. If all_team_aliases maps many variant names to canonical team_id:
    • Merge all_teams_data with all_team_aliases using team name columns to produce canonical team_id and team_name.
    • Or in Power Query replace team name column values using Merge Queries / Left Join and expand canonical fields.
  2. This ensures team IDs used across matches and ball-by-ball are consistent.

5. Model design and relationships (Model view)

  1. Open Model view.
  2. Create these relationships:
    • all_ipl_matches_data[match_winner]all_teams_data[team_id]
      • Cardinality: Many to One (* → 1), Single direction. Set this relationship ACTIVE.
    • all_ipl_matches_data[team1]all_teams_data[team_id] and all_ipl_matches_data[team2]all_teams_data[team_id]
      • These could be created if you want direct lookups—only one of these can be active with match_winner if they share the same key. Usually you keep match_winner active and leave others inactive, but it depends on your model usage.
    • For the ball-by-ball table:
      • all_ball_by_ball_data[match_id]all_ipl_matches_data[match_id] (Many→One on matches). This is typically ACTIVE.
      • If ball data has batting_team_id or bowling_team_id you may link to all_teams_data[team_id] (as needed).
  3. Note: Power BI allows only one active relationship between two particular tables on the same pair of keys. Use USERELATIONSHIP() to activate alternate relationships in DAX.

6. Create the losing-team calculated column (matches table)

  1. In Data view, select all_ipl_matches_data then New column and paste:
LosingTeam =
IF(
    all_ipl_matches_data[match_winner] = all_ipl_matches_data[team1],
    all_ipl_matches_data[team2],
    all_ipl_matches_data[team1]
)
  1. This creates the losing team ID for each match.

7. Create team name columns (Winner and Loser)

  1. Winner team name (active relationship to match_winner):
WinnerTeamName =
RELATED(all_teams_data[team_name])
  1. Losing team name (requires activating the alternate relationship inside a calculation):
LosingTeamName =
CALCULATE(
    SELECTEDVALUE(all_teams_data[team_name]),
    USERELATIONSHIP(
        all_ipl_matches_data[LosingTeam],
        all_teams_data[team_id]
    )
)
  1. If you created team1 or team2 relationships as inactive, similar USERELATIONSHIP() can be used to pull names for team1/team2 when needed.

8. Flag finals (using a lookup table you created)

  1. If you created IPL_Finals table (DATATABLE or CSV), create a boolean/text column in all_ipl_matches_data:
IsFinal =
IF(
    CONTAINS(
        IPL_Finals,
        IPL_Finals[id], all_ipl_matches_data[match_id]
    ),
    "Final",
    "Non-Final"
)
  1. Or return TRUE/FALSE by removing the IF wrapper and using CONTAINS directly.

9. Core measures (ball-by-ball and match level)

Use measures (not columns) for aggregated KPIs.

  1. Total Runs (from ball-by-ball):
TotalRuns =
SUM(all_ball_by_ball_data[batsman_runs])
  1. Total Balls (count deliveries; if ball-by-ball has ball rows per delivery):
TotalBalls =
COUNTROWS(all_ball_by_ball_data)
  1. Overs (derived):
TotalOvers =
DIVIDE([TotalBalls], 6)
  1. Match Count:
MatchesCount =
DISTINCTCOUNT(all_ipl_matches_data[match_id])
  1. Seasons Count:
SeasonsCount =
DISTINCTCOUNT(all_ipl_matches_data[season])
  1. Count of 4s and 6s (if batsman_runs is available):
FoursCount =
COUNTROWS(
    FILTER(
        all_ball_by_ball_data,
        all_ball_by_ball_data[batsman_runs] = 4
    )
)

SixesCount =
COUNTROWS(
    FILTER(
        all_ball_by_ball_data,
        all_ball_by_ball_data[batsman_runs] = 6
    )
)

If your ball table already includes is_four and is_six flags use SUM(all_ball_by_ball_data[is_four]) and SUM(all_ball_by_ball_data[is_six]).


10. Team-centric measures (wins, win%)

  1. Team wins (when shown in context of all_teams_data table):
TeamWins =
CALCULATE(
    COUNTROWS(all_ipl_matches_data),
    FILTER(
        all_ipl_matches_data,
        all_ipl_matches_data[match_winner] = SELECTEDVALUE(all_teams_data[team_id])
    )
)
  1. Team matches played (counts number of times team appears as team1 or team2):
TeamMatchesPlayed =
CALCULATE(
    COUNTROWS(all_ipl_matches_data),
    FILTER(
        all_ipl_matches_data,
        all_ipl_matches_data[team1] = SELECTEDVALUE(all_teams_data[team_id])
            || all_ipl_matches_data[team2] = SELECTEDVALUE(all_teams_data[team_id])
    )
)
  1. Win percentage:
TeamWinPercent =
DIVIDE([TeamWins], [TeamMatchesPlayed], 0)

11. Validate the model and test values

  1. Create simple Table visuals to show match_id, team1, team2, match_winner, LosingTeam, WinnerTeamName, LosingTeamName.
  2. Cross-check a few known match rows from your CSV to confirm the columns resolve correctly.
  3. Create a card visual for MatchesCount, TotalRuns, TotalOvers to confirm totals match expectations.

12. Performance & best practices

  1. Prefer measures for aggregations (faster, flexible).
  2. Use calculated columns only when you need row-level values (like LosingTeam).
  3. Avoid overly complex row-by-row iterators; prefer SUMX only when needed.
  4. Keep data types consistent across relationships (both sides must be same numeric type).
  5. Document your model: add descriptions to tables and measures.

13. Next steps (visuals and storytelling)

  1. Build visuals: season bar chart, 4s/6s combo, season-wise total runs, KPI cards (Matches, Balls, Overs, Seasons).
  2. Use slicers for season and team_name.
  3. Add tooltips that show measures like TeamWins, Win%.
  4. Save and publish to Power BI Service if you want to share the dashboard.

This step-by-step guide provides the exact DAX and the recommended modeling pattern for dual foreign keys (winner + loser), ball-by-ball aggregation, and match-level derived columns.


🎯 About the Creator

This IPL dashboard and tutorial has been designed and taught by:

Ankit Srivastava
Lead Trainer at Slidescope

With deep expertise in Power BI, Data Analytics, and Business Intelligence, Ankit focuses on teaching through real-world datasets and practical dashboards, making learning both effective and job-ready.


🚀 What’s Next?

This is Part 1 of the IPL analytics series. The upcoming parts are expected to dive deeper into:

  • Team-wise performance
  • Player impact analysis
  • Toss vs match result trends
  • Finals vs non-final performance
  • Home vs away dominance