cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

How to create a subtotal based on subgroup

Hi all,

 

I have a situation in which I want to calculate the weight percentage for each of the panel type by each sector. However, I do not know how to get the subtotal by Sector.

For example: I want to derive the weight percentage, and I need the denominator value which is the total for each sector and the nominator is the total of all the types under each of sector.

 

I have a horizotal bar chart that break down the visualisation by sector and by panel types. 

For some reason the percentage value I compute using ALL function keep getting the wrong value.

Please be advise that the Sector filter and the Type filter are pull in from two independent dimension tables while the spend amount value is pulled from a fact table.

 

the following are my measure object (i.e. Sector Spend %) and it is not correct:

Sector Spend % = DIVIDE([total_invoice_amt],
                                          Calculate('legal spend'[total_invoice_amt], All('ProfitCenterStructure'[Sector]), ALL('panel types'[Types])))
 
total_invoice_amt = SUM('legal spend'[InvAmountAUD])
 
Any idea I misss out? Thanks .. tuff

Capture.JPG

 

Desktop screen:

Capture2.JPG

1 ACCEPTED SOLUTION

Accepted Solutions
RobinDeFal Resolver II
Resolver II

Re: How to create a subtotal based on subgroup

Hi @Anonymous ,

 

If I understand correctly, try this out:

 

SECTOR SPEND % = 
Var one = 
CALCULATE( SUM( 'Table'[total_invoice_amt] ), ALLEXCEPT( 'Table' , 'Table'[Sector] ))

VAR two =
CALCULATE( SUM( 'Table'[total_invoice_amt] ), ALLEXCEPT( 'Table' , 'Table'[Sector] , 'Table'[Types] ))

Return 
two / one

Result:

capture 9.JPG

 

Let me know if that worked for you.

Cheers

Robin

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
RobinDeFal Resolver II
Resolver II

Re: How to create a subtotal based on subgroup

Hi @Anonymous ,

 

If I understand correctly, try this out:

 

SECTOR SPEND % = 
Var one = 
CALCULATE( SUM( 'Table'[total_invoice_amt] ), ALLEXCEPT( 'Table' , 'Table'[Sector] ))

VAR two =
CALCULATE( SUM( 'Table'[total_invoice_amt] ), ALLEXCEPT( 'Table' , 'Table'[Sector] , 'Table'[Types] ))

Return 
two / one

Result:

capture 9.JPG

 

Let me know if that worked for you.

Cheers

Robin

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
New Ranks Launched March 24th!

New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

‘Better Together’ Contest Finalists Announced!

‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Arun 'Triple A' Event Video, Q&A, and Slides

Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

Join THE global Microsoft Power Platform event series.

Join THE global Power Platform event series.

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors