How to Show Ratio in Power BI
Showing a ratio in Power BI - like conversions to clicks or revenue to ad spend - is one of the most effective ways to add context to your reports. Instead of just presenting isolated numbers, a ratio shows the relationship between them, telling a much richer story. This article will guide you through calculating, formatting, and visualizing ratios in Power BI using DAX for both calculated columns and measures.
What is a Ratio and Why Does it Matter?
At its core, a ratio compares two quantities. A standalone metric like "500 conversions" is useful, but it doesn't tell you anything about efficiency. Is that good or bad? By creating a ratio, you can answer that. If you had 1,000 clicks, your conversion-to-click ratio is 1:2 (or 50%). If you had 50,000 clicks, that same 500 conversions looks much less impressive.
Ratios provide comparative context that helps you:
Measure efficiency (e.g., Clicks per conversion, marketing spend vs. revenue)
Understand proportions (e.g., Male to female customer ratio)
Track performance against goals (e.g., Win/loss ratio for a sales team)
In business intelligence, this context is everything. It transforms raw data into actionable insights, helping you see not just what is happening, but how efficiently it's happening.
Option 1: Creating a Ratio with a Calculated Column
A calculated column adds a new column to one of your tables. The calculation is performed for each row in that table during the data refresh, and the result is stored in the data model. This is the right choice when the ratio you need is static and based on values from the same row.
For example, imagine you have a sales table with OrderRevenue and OrderCost columns for each transaction. You could create a profit ratio column that calculates this value for every single order.
Step-by-Step Instructions
Let's calculate a simple profit-to-cost ratio for each sale in a table named 'SalesData'.
Go to 'Data view': In Power BI Desktop, click the table icon on the left-hand pane to enter the Data view.
Select your table: Choose the 'SalesData' table from the Fields pane on the right.
Add a New Column: In the 'Table tools' tab that appears on the ribbon at the top, click 'New column'.
Enter the DAX Formula: The formula bar will appear. Here, you need to define how to calculate your ratio. The most direct way to divide one number by another is with the slash operator (
/).
Press 'Enter'. Power BI will calculate this for every row and add a new column to your table.
Best Practice: Avoiding the Dreaded 'Infinity' Error
There's a potential problem with the simple formula above. What happens if a row has an OrderCost of zero? You can't divide a number by zero. If this happens, Power BI will return an "Infinity" error, which breaks your visuals.
DAX has a built-in function to handle this: DIVIDE(). The DIVIDE() function takes three arguments: a numerator, a denominator, and an optional result for cases where the denominator is zero. It's much safer and more robust.
Let's rewrite our formula using DIVIDE():
Now, if any row has an OrderCost of zero, the formula will return 0 instead of an error, keeping your reports clean and functional.
Option 2: Creating a More Flexible Ratio with a Measure
More often than not, a measure is the best way to calculate ratios in Power BI. Unlike a calculated column, measures are calculated on-the-fly based on the context of your report (like any active filters or slicers). They don't store data in your model, which keeps your file size small and your reports fast.
This approach is perfect for calculating high-level ratios that need to respond to user interactions, like an overall marketing conversion rate that changes when you filter by a specific campaign or date range.
A great practice in DAX is to create foundational measures for your numerator and denominator first, then combine them in a final ratio measure. This makes your formulas easier to read, debug, and reuse across your report.
Step-by-Step Instructions
Let's create a sales Win/Loss ratio. Assume we have a 'Deals' table with a 'Status' column that contains either "Won" or "Lost".
Go to 'Report view': Click the canvas icon in the top left pane.
Create the 'Wins' Base Measure: On the 'Home' tab, click 'New measure'. Enter the following DAX formula:
This formula counts the number of rows in the 'Deals' table where the 'Status' is explicitly "Won".
Create the 'Losses' Base Measure: Create another new measure with this formula:
Create the Ratio Measure: Now a final measure that brings it all together using
DIVIDE(). Create a third new measure:
You now have a dynamic measure that will always calculate the proper Win/Loss Ratio based on whatever filters are active on your report page.
How to Format Your Ratio for Maximum Clarity
Once you have your ratio calculated, the next step is formatting it. A raw number like 1.25 is accurate, but it isn't always intuitive. Is that 1.25 to 1? Or 5 to 4? Clear formatting turns a good number into a great insight.
Displaying the Ratio as a Percentage
This is the most common format, perfect for conversion rates or market share.
Select the measure you want to format (e.g.,
Win Loss Ratio) in the 'Fields' pane.The 'Measure tools' contextual tab will appear in the ribbon.
In the 'Formatting' section, you can set the format to 'Percentage' from the dropdown menu and specify the number of decimal places.
Displaying the Ratio in "X:Y" Format
Sometimes, a classic "colon" format like 2:1 or 5:1 communicates the relationship much more clearly, especially when comparing two distinct groups (e.g., support agents to customers). This requires a bit more advanced DAX to create a text string.
Let's format our Win Loss Ratio this way. We will create a new measure specifically for formatting.
Step 1: The Basic "X : 1" Format
This format shows you how many wins there are for every single loss.
How this works:
FORMAT([Win Loss Ratio], "0.0")converts the numeric ratio (e.g.,1.25) into a text string with one decimal place ("1.3").& " : 1"appends the text " : 1" to the end.
If your Total Wins were 50 and Total Losses were 40, this formula would return the string "1.3 : 1".
Step 2: A More Advanced "Whole Number" Ratio
Displaying the ratio using the smallest possible whole numbers (e.g., turning 1.25 into 5:4) is much trickier and involves finding the Greatest Common Divisor (GCD) of your numerator and denominator. While possible in DAX, it's often more complex than needed for most business reports. Sticking to the X : 1 format or a simple percentage typically provides the clearest result with the least complexity.
Best Visuals for Displaying Ratios in Power BI
Once your ratio measure is ready, you need to decide how to show it.
Card Visual: Perfect for a single, critical North Star metric. Just drag your ratio measure onto a card visual to prominently display it on your dashboard. This is great for showing your overall company Win/Loss Ratio or conversion rate.
Gauge Visual: A gauge works well if your ratio has a target or goal associated with it. You can set the gauge's minimum, maximum, and target values to visualize performance at a glance.
Table or Matrix: Use a table or matrix to see how the ratio breaks down across different categories. For example, drag 'Sales Rep' onto the rows of a table and your
Win Loss Ratiomeasure into the Values to see who has the best performance.Bar or Column Chart: Visualize ratios across categories by placing the category (e.g., 'Marketing Campaign') on the axis and the ratio measure in the 'Values' field. This quickly spots high and low-performing segments.
Final Thoughts
Calculating ratios in Power BI adds a powerful layer of context to your data, moving you from simply observing numbers to understanding performance and efficiency. By using DAX measures with the DIVIDE() function, you can create flexible, error-free ratios that adapt to user selections and then visualize them in a way that tells a clear and compelling story.
Pulling all the necessary data from different sources and then building these DAX measures can still take a lot of clicking and typing. We built Graphed to remove this manual work. You can simply connect your data sources through our one-click integrations, then ask for what you need in plain English. For example, you can tell us to "create a dashboard showing my win/loss ratio by sales rep," and our AI-powered analyst will instantly generate live, interactive visualizations, saving you from writing the DAX yourself.