[PowerBI/SQL] Expectation vs Reality — How do we measure a football advanced statistical metric called “xG” ⚽

Thiago Araujo
2 min readApr 19, 2022


If you are a football addict like me and love statistics about this sport, you probably heard this expression before. But what is it? xG is an abbreviation that stands for ‘expected goals’. It is a statistical measurement of the quality of goalscoring chances and the likelihood of them being scored.
An xG measurement can be generated for both teams as a whole and individual players, giving an indication as to how well they should be performing in front of the goal. 📊
And how do we calculate this metric?

  • Distance to the goal
    - Angle to the goal
    - One-on-one
    - Big chance
    - Body part (e.g., header or foot), etc.

In order to understand providing you with a good example, I took the stats of FC Bayern München in Bundesliga (2021–2022), which is known for often hammering its opponents in this league and also in the Champions League (okay, they had a bit of bad luck in the current European league, but never mind). 😨

Let’s try to comprehend the players' stats and take a look at the comparison between the goals scored and the xG.
Robert Lewandowski leads the xG and goals numbers of his team. The Polish forward had 29.1 xG and scored 32.
What does this mean? From the chances that Lewa had we would expect the average player to score 29 goals (29.1 xG). The last image of the file shows the positions where Lewandowski scores. For every place in the field, there are a lot of calculations on how to measure the probability to score from that point.

But now the game is in your hands: can you tell in the comments section why Lewa and Serge Gnabry scored more than expected? ❓

Leave your impressions! 📋



Thiago Araujo

Financial Manager, Data Analyst and studying Data Science to be the next genius of my house. I love football, burger and drums.