Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
mikekolba1
New Member

Trying to get a calculation from 2 different column totals....

I have two columns that are calculating row values  correctly with these formulas but the latter Site Target GP was not calculating the total properly so i had to modify 

 

 

Original


Current Revenue = CALCULATE(
SUM(Query1[Column2]),
FILTER(Query1,SEARCH("Current",Query1[Source.Name],,0)),
FILTER(Query1,Query1[Column1]="Revenue")
)

 

and

 

Site Target GP = [Current Revenue]*[Target GP Margin %]

The above was modified to this in order to calcuate the total value correctly, which it does
 
Site Target GP TotalCalc = IF(HASONEFILTER(Query1[Site]),[Site Target GP],SUMX(VALUES(Query1[Site]),[Site Target GP]))
 
Now I have another calculation i want to do for Site Target GP % based on the "totals" of these 2 calculations
 
I want to calculate
 
Site Target GP% = [Site Target GP]/[Current Revenue]
 
and individual sites get calculated correctly for this but
 
but for the "Total"of the Site Target GP% calculation I need to do something simliar to what i did with the Site Target GP calculation and override the "total" 
 
The formula needs to be the value of  Total "Current Reveue" (of all sites) which totals correctly for all sites with the first formula and the default power BI summation  divided by  the total value I'm obtaining via  Site Target GP TotalCalc = IF(HASONEFILTER(Query1[Site]),[Site Target GP],SUMX(VALUES(Query1[Site]),[Site Target GP])) 
 
How's the best way to achieve this? These are all "measures' also. 
 
 
 
 
 
2 ACCEPTED SOLUTIONS
dharmendars007
Super User
Super User

Hello @mikekolba1 

 

To calculate the overall total (denoted as "X" in your example), you need to do a weighted average calculation using Current Revenue as the weight.

 

Instead of directly summing up the percentages, you can use this formula to calculate the total Site Target GP % based on the weighted average

 

SiteTargetGP_TotalCalc =
IF(
HASONEFILTER(Query1[Site]),[Site Target GP %], -- Use the individual site value
DIVIDE(
SUMX(VALUES(Query1[Site]), [Site Target GP] * [Current Revenue]),

SUMX(VALUES(Query1[Site]), [Current Revenue])))

 

If you find this helpful , please mark it as solution which will be helpful for others and Your Kudos/Likes 👍 are much appreciated!

 

Thank You

Dharmendar S

LinkedIN 

 

 

 

View solution in original post

Doing this though got me the answer i needed so giving you credit as it led me to it

SiteTargetGP_TotalCalc =
IF(
HASONEFILTER(Query1[Site]),[Site Target GP %], -- Use the individual site value
DIVIDE(
SUMX(VALUES(Query1[Site]), [Site Target GP]),

SUMX(VALUES(Query1[Site]), [Current Revenue])))

View solution in original post

4 REPLIES 4
dharmendars007
Super User
Super User

Hello @mikekolba1 

 

To calculate the overall total (denoted as "X" in your example), you need to do a weighted average calculation using Current Revenue as the weight.

 

Instead of directly summing up the percentages, you can use this formula to calculate the total Site Target GP % based on the weighted average

 

SiteTargetGP_TotalCalc =
IF(
HASONEFILTER(Query1[Site]),[Site Target GP %], -- Use the individual site value
DIVIDE(
SUMX(VALUES(Query1[Site]), [Site Target GP] * [Current Revenue]),

SUMX(VALUES(Query1[Site]), [Current Revenue])))

 

If you find this helpful , please mark it as solution which will be helpful for others and Your Kudos/Likes 👍 are much appreciated!

 

Thank You

Dharmendar S

LinkedIN 

 

 

 

Doing this though got me the answer i needed so giving you credit as it led me to it

SiteTargetGP_TotalCalc =
IF(
HASONEFILTER(Query1[Site]),[Site Target GP %], -- Use the individual site value
DIVIDE(
SUMX(VALUES(Query1[Site]), [Site Target GP]),

SUMX(VALUES(Query1[Site]), [Current Revenue])))

Thanks Dharmendra- In this case , not quite.  the individual site % are correct but the overall "total" % calculation is incorrect and actually way higher-

so for example

 

My site target GP total calc number is like 400,000

 

My Current Revenue total number is like 2,600,000 

 

it should calculate about 15% as an example.  using what you provided it calculated around 95,000 % 

mikekolba1
New Member

some example data to illustrate

siteCurrent RevenueSite Target GPSite Target GP TotalCalcSite Target GP%Site Target GP% TotalCalc
a50551010
b55881111
c507799
d304455
Total18524635X


Trying to get the (X) calculated value from the 185/6  (30.333)  using the measure information above

 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.