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 September 15. Request your voucher.

Reply
Carludo
Regular Visitor

How to calculate the total from the sum of items in the same column

Hi,

 

I have a column with the Funds for clients which can be Expense or Income; how do I calculate the Funds percent to display the expense as a percentage of the full income which in the example below is 3530.28

 

For instance the first expense should be 11.34% instead of the 14.70% below. 

Carludo_0-1733263695989.png

The formula I am using is showing me the percentage per row per group instead; below is the formula I found in a forum.

 

Funds Percent = sum('HCP Statement Data'[Funds])/CALCULATE(sum('HCP Statement Data'[Funds]),FILTER(ALLSELECTED('HCP Statement Data'),'HCP Statement Data'[Expenses type]=SELECTEDVALUE('HCP Statement Data'[Expenses type])))

 

Thanks for your help

1 ACCEPTED SOLUTION

hello @Carludo 

 

i assume [Sum of Funds] is a measure.

Next, you need to calculate [Sum of Funds] inside your table with "Income" as filter to get full income value.

After that, you can just divide those two measure to get [Funds Percent].

 

Irwan_0-1733288634550.png

Funds Percent = 
var _Total = CALCULATE([Sum of Funds],ALL('Table'),'Table'[Type]="Income")
Return
DIVIDE(
    [Sum of Funds],
    _Total
)
 
note: ignore the 'No' column since you are most likely have another column to differentiate those expense and income, it just there to keep those rows separated otherwise it will be summarized when put in table visual.
 

Hope this will help.

Thank you.

View solution in original post

9 REPLIES 9
Carludo
Regular Visitor

I would be happy with the -11.34% too since it is techically a deduction from the sum of Income. I just cant get that elusive 11.34% happening or any of the Expense entries to be divided by the full Income

lbendlin_0-1733281107741.png

Funds Percent = divide(sum('HCP Statement Data'[Funds]),CALCULATE(sum('HCP Statement Data'[Funds]),'HCP Statement Data'[Expenses type]="Income",REMOVEFILTERS('HCP Statement Data'[Index])))

 

Hi Ibendlin,

I am getting the following error with that formula: "Column 'Index' in table 'HCP Statement Data' cannot be found or may not be used in this expression"

 

If I replace Index with "Expenses Type" to remove the filter I get the following: 

Carludo_0-1733283300188.png

The good news is that is calculating the % of the remaining funds out of the total income instead of displaying Infinity as it was before

 

In Power Query add an index column. Include it in the visual.

I created the Index in the query, reloaded the data and added it to the table but it is still only displaying the PErcentage for the Income items

Carludo_0-1733286516054.png

 

hello @Carludo 

 

i assume [Sum of Funds] is a measure.

Next, you need to calculate [Sum of Funds] inside your table with "Income" as filter to get full income value.

After that, you can just divide those two measure to get [Funds Percent].

 

Irwan_0-1733288634550.png

Funds Percent = 
var _Total = CALCULATE([Sum of Funds],ALL('Table'),'Table'[Type]="Income")
Return
DIVIDE(
    [Sum of Funds],
    _Total
)
 
note: ignore the 'No' column since you are most likely have another column to differentiate those expense and income, it just there to keep those rows separated otherwise it will be summarized when put in table visual.
 

Hope this will help.

Thank you.

Hi Irwan,

 

Thank you for the guidance; Funds is a column on the dataset but with your formula I was able to do some small changes and use ALLSELECTED instead of ALL and got the correct figures

 

Carludo_0-1733290846465.png

 

 

hello @Carludo 

 

glad to see it works.

 

Thank you.

lbendlin
Super User
Super User

Why not -11.34% ?

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Kudoed Authors