In this Power Bi tutorial, we will discuss how to calculate percentage of two columns in Power BI, In addition, we will also learn how to calculate the percentage difference between two columns in Power BI.
Power BI Calculate the Percentage of Two Columns
Here we will see how we can calculate the Percentage of two columns in the Power BI report.
In this example, we will use the below-mentioned Daily Rate sample data consisting of two sheets called Monthly Rate and Monthly Target to calculate the percentage value of two columns in Power BI.
Monthly Rate:
Monthly Target:
- Load data into the Power Bi desktop, Click on the new measure and apply the below formula to calculate the percentage value of two columns.
% Achieved =
VAR Month_Rates =
SUM ('Monthly Rate'[Rate] )
VAR Target_Rates =
SUM ('Monthly Target'[Target] )
RETURN
( Month_Rates - Target_Rates )
/ Month_Rates
Where,
- % Achieved = Measure Name
- Month_Rates, Target_Rates = Variable Names
- Monthly Rate, Monthly Target = Table Names
- Select the table visual from the visualization, drag-drop the year, month, rate, and target fields from the field pane, and the created % Achieved measure value in it as highlighted below:
- To show Percentages change the format to a percentage by selecting Measure tools -> Percentage as highlighted below:
- The screenshot below displays the achieved percentage value based on the condition applied.
This is how to calculate percentage of two columns in a Power BI report.
Calculate Percentage difference between Two Columns in Power BI
Let us see how we can calculate the percentage difference between two columns in Power BI,
In this example, first, we will find the difference value between the rate and target columns later we will use the Power Bi Divide function to find the percentage value.
Open the Power Bi desktop and load data into it, and use the below formula to calculate the percentage difference between two columns in Power BI,
% difference =
VAR MonthRate = SUM ('Monthly Rate'[Rate] )
VAR MonthTarget = SUM ('Monthly Target'[Target] )
VAR difference = MonthRate - MonthTarget
VAR Result = DIVIDE (differnce,MonthRate,BLANK())
RETURN Result
Where,
- % difference = Measure Name
- MonthRate, MonthTarget, difference, Result = Variable Names
- Monthly Rate, Monthly Target = Table Names
- Rate, Target = Column Names
- Select the table visual from the visualization, drag-drop the year, month, rate, and target fields from the field pane, and the created % difference measure value in it as highlighted below:
- Select the measure and choose Measure tools -> Percentage as highlighted below to change the measure format to percentage.
- In the below screenshot, you can see the table visually displays the Calculate Percentage difference between Two Columns Power BI report.
This is how to calculate the percentage difference between two columns in Power BI.
In this Power Bi tutorial, we have discussed how to calculate percentage of two columns in Power BI. Also, we learned how to calculate the percentage difference between two columns in Power BI.
You may like the following Power BI tutorials:
- Power BI Percentage of Total by Month
- Power BI Percentage of Total by Category
- Power BI Percent of Total
- Power BI Month over Month Change
I am Bijay a Microsoft MVP (10 times – My MVP Profile) in SharePoint and have more than 17 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com