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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
toddpbi
Helper II
Helper II

SUM only the values contained in a separate column

Hi there everyone,

 

Here is my data set(s):

 

2018-03-28_18h33_13.png2018-03-28_18h33_44.png

 

What I am trying to achieve is to sum up the total actuals column only if the values contained in column "cost report" are present in "GL account" in table one. What is the formula required to acheive this total? Essentially, I want to only aggregate the sub-accounts without double counting the main accounts (represented by *, ** etc).

 

Thank you for your help.

1 ACCEPTED SOLUTION

Dear Owen, Thank you very much for your help.

That was my original plan of attack to solve this issue. But by removing the rows containing the "*" astericks, it would require a manual adjustment when new accounts are added to the Power BI file.

 

Insead, what I did was create a temporary "vlookup column", which searches whether the GL account from the 2nd table contains values from the 1st hierarchy table using this formula:

 

VLOOKUP = CALCULATE(COUNTROWS('Chart of Accounts'), FILTER('Chart of Accounts', 'Chart of Accounts'[GL Account]=Actuals[GL Account])) > 0

This returns true or false values depending on whether the account name is found in the hierarchy GL column from the hierarchy table. Then I created a measure: Total Actuals = CALCULATE ( SUM ( 'Actuals[Actuals]), Actuals[VLOOKUP] = TRUE() to avoid the double counting issue.

 

Thank you again for your help!!

View solution in original post

2 REPLIES 2
OwenAuger
Super User
Super User

Hi there,

 

It's best not to include total rows of any sort in a fact table, so that this double-counting problem doesn't arise.

 

I would recommend you remove any rows where Cost Report contains a "*" by modifying the original query.

 

You should then ensure there is a relationship between the Cost report column in the 2nd table and the GL Account column in the 1st table, and ensure that any required hierarchy columns are present in the 1st table (looks like they probably are).

 

Regards,

Owen


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

Dear Owen, Thank you very much for your help.

That was my original plan of attack to solve this issue. But by removing the rows containing the "*" astericks, it would require a manual adjustment when new accounts are added to the Power BI file.

 

Insead, what I did was create a temporary "vlookup column", which searches whether the GL account from the 2nd table contains values from the 1st hierarchy table using this formula:

 

VLOOKUP = CALCULATE(COUNTROWS('Chart of Accounts'), FILTER('Chart of Accounts', 'Chart of Accounts'[GL Account]=Actuals[GL Account])) > 0

This returns true or false values depending on whether the account name is found in the hierarchy GL column from the hierarchy table. Then I created a measure: Total Actuals = CALCULATE ( SUM ( 'Actuals[Actuals]), Actuals[VLOOKUP] = TRUE() to avoid the double counting issue.

 

Thank you again for your help!!

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors