DAX - Parent Category Total

DickyMoo

New Member
Joined
Mar 8, 2016
Messages
32
Hello All,

I am looking for a formula to calculate the total of the current Category, shown against each Sub-Category, as below:

Category Sub-Category Amount Category Total
Income Charitable Income 100 400
Income Other Income 300 400
Expenditure Staff Costs 200 700
Expenditure Other Costs 500 700


The problem is that I am using a Power BI chart which does not include Category,so I can't use the normal CALCULATE( [SUM], ALL( Account[Sub-Category]) ), that just gives me 1,100 for all rows.

I have been scratching my head for a while over this, does anyone know what approach I could try?

Thanks
Rich
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Add column:

=CALCULATE(SUM([Amount Category]);FILTER('Table1';[Category]=EARLIER('Table1'[Category])))
 
Upvote 0
Thanks, that works as a column.

I should have specified that I am looking for a measure to use directly in the chart.
 
Upvote 0
Hi Rich,

You may well have figured this out in the mean time.
But I would use a measure like this:

Code:
= 
CALCULATE(
    SUM ( Account[Amount] ),
    ALL ( Account[Sub-Category] ),
    VALUES ( Account[Category] )
)

This is assuming your Sub-Category and Category columns are all in the same table.

Owen
 
Last edited:
Upvote 0
Thank you Thank you Thank you!!!

DAX is such a strange language, deceptively simple but you really have to know what you're doing.

Rich
 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,689
Members
449,117
Latest member
Aaagu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top