Consulting Work About Book Writing Contact

The 80/20 Rule in Power BI: Finding the Cities That Really Pay the Bills

Have you ever noticed that a small part of something tends to account for most of the results? A few customers bring in most of the revenue. A handful of products fill most of the orders. A short list of clients eats up most of your time. That pattern has a name, and once you start seeing it, you cannot unsee it.

It is called the Pareto principle, or the 80/20 rule, and in this post I want to show you what it means and how I built a proper Pareto analysis in Power BI using a few custom DAX measures. This is one of the many real business scenarios I walk through in my book, Mastering DAX in Power BI, and it is a lovely example of how a little bit of DAX turns a plain chart into something a manager can act on.

So what is the 80/20 rule?

The idea comes from an Italian economist called Vilfredo Pareto, who noticed roughly a century ago that about 80 percent of the land in Italy was owned by about 20 percent of the people. Since then people have spotted the same lopsided split all over the place. The exact numbers are never perfectly 80 and 20, but the shape holds up surprisingly often: a small slice of the inputs drives a large slice of the outputs.

In plain terms, it tells you where to look. If you can find the 20 percent that matters most, you know where to put your attention, your budget and your energy. Everything else is still there, it just is not where the story is.

In my report the question was simple. Out of all the cities where the business operates, which ones actually bring in the money? The chart answers exactly that. It shows you where 80 percent of the gross income comes from, so you can see at a glance which cities are doing the heavy lifting.

Reading the chart

Take a look at the screenshot. Each blue bar is a city, and the bars are sorted from the biggest earner on the left down to the smallest on the right. Canyon Country leads the way with about $96K, then the bars step down city by city.

The rising red line is the clever bit. It is the running total, expressed as a percentage. It starts low on the left and climbs as you add each city's income on top of the last, until it reaches 100 percent at the far right when every city has been counted. Because the biggest earners sit on the left, the line shoots up steeply at first and then flattens out. That flattening is the Pareto principle showing itself. The early cities add a lot, the later cities add very little.

The two horizontal lines are reference markers. One sits at 80 percent, the classic Pareto threshold. There is also a movable line driven by the dropdown at the top, set to 70 percent in the screenshot, so you can slide the target up or down and ask a different question whenever you like. Wherever the red line crosses your chosen threshold, that is your cut off point. The cities to the left of it are the ones that matter most.

How I built it in DAX

Here is where the fun starts. The whole thing rests on four measures. I have given them friendly names below so they are easy to follow, and the code is exactly what runs in the report.

City Ranking

First I need to know each city's position in the pecking order, from highest income to lowest.

dax
1-city_ranking_gross_income = IF(HASONEVALUE('sales customers'[city]), RANKX(ALLSELECTED('sales customers'[city]), CALCULATE([gross_income]),,DESC,Dense))

RANKX does the ranking. It looks across all the cities the user has selected and hands out positions based on gross income, biggest first. The Dense setting means the ranks run 1, 2, 3 with no gaps, even when two cities tie. The HASONEVALUE check at the front is a small safety catch. It makes sure the measure only calculates when there is a single city in context, which keeps the ranking sensible on every row of the chart.

Cumulative Income

Next I add things up as I go along.

dax
2-city_cumulative_amount = 
VAR
    CurrentRank = [1-city_ranking_gross_income]
RETURN
    SUMX(
        FILTER(
            ALLSELECTED('sales customers'[city]), CALCULATE([1-city_ranking_gross_income]) <= CurrentRank), CALCULATE([gross_income]))

For any city on the chart, this grabs its rank, then walks through every city that ranks at or above it and sums their gross income. So for the top city you get just its own income. For the second city you get the top two combined. For the third, the top three, and so on. That is the running total that feeds the line.

Cumulative Percentage

A running total in dollars is useful, but a percentage is easier to talk about.

dax
3-city_cumulative% = [2-city_cumulative_amount] / CALCULATE([gross_income], ALLSELECTED('sales customers'[city]))

This takes the running total for each city and divides it by the grand total across all selected cities. The result is the share of income earned by everything up to and including that city. This is the red line you see climbing towards 100 percent.

80% Line

Finally, the reference line itself.

dax
80%_line = 0.8

Nothing fancy here. It is a flat value of 0.8 so the chart can draw a straight line across at 80 percent. It gives your eye something to aim at, and it makes the cut off point obvious the moment the red line crosses it.

What the finished analysis tells you

Put those four measures together and you get a picture that pays for itself. Instead of a long, flat list of cities that all look roughly the same, you can see in a second that a minority of cities carry the bulk of the income, and you can point to exactly where the 80 percent mark falls.

That changes conversations. It tells a sales team where to double down. It tells a regional manager which markets deserve the next campaign. It tells the finance side which cities to watch most closely. And because the threshold is adjustable, you are never stuck with one answer. Want to know which cities make up 70 percent, or 90 percent? Slide the control and the story updates on the spot.

Want to build things like this yourself?

This Pareto analysis is one of many practical scenarios I cover in my book, Mastering DAX in Power BI. Rather than teaching DAX as a dry list of functions, I walk you through the sort of questions real businesses actually ask, and show you how to answer them with measures you can reuse in your own reports. Power BI is the leading business intelligence tool for a reason, and DAX is what unlocks its real power.

If you would like to learn more of these scenarios and get comfortable writing DAX with confidence, you can grab the book here: Amazon link.

← All writing