cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
New Member

Calculating the % for the Row subtotal in Table/matrix visual

Hi Friends,

Looking for help and hoping someone has already navigated this water and can help.  I had a tabular visual in Excel which looks like below.   My Data table has Bldg and New/Old attached to Patient ID and so I can aggregate them, and in my Excel table, just divide the cells like New/Total to create the % subtotals. 

In Power BI, I have a Matrix visual where I have the Bldg and New/Old as rows, month as a column and Values as Count (patient ID) so I am able to create the rows for New, Old and Total.  However, I am not able to create the % anymore as not sure how to divide the New/Total. 

Do I need to create a measure or calculated column?  How do I go about it?  Thanks a lot for your help.

EXCEL VIEW:

 JanFeb
Bldg 1 New430402
Bldg 1 Old9491,824
Bldg 1 Total  (calculation)13792,226
Bldg 1 New  (calculation)31%18%

Bldg 1 Old % (calculation)

69%82%
Bldg 2 New100400
Bldg 2 Old9001600

Bldg 2 Total

(calculation)

10002000

Bldg2 New % (calculation)

10%20%

Bldg2 Old % (calculation)

90%80%
1 ACCEPTED SOLUTION
Community Support
Community Support

Hi @ss0102 ,

 

Column or Measure is al

Here's the formula for calculated column.

jan%_c = CALCULATE(SUM('Table'[Jan]),ALLEXCEPT('Table','Table'[Bldg],'Table'[New/Old]))/CALCULATE(SUM('Table'[Jan]),ALLEXCEPT('Table','Table'[Bldg]))

feb%_c = CALCULATE(SUM('Table'[Feb]),ALLEXCEPT('Table','Table'[Bldg],'Table'[New/Old]))/CALCULATE(SUM('Table'[Feb]),ALLEXCEPT('Table','Table'[Bldg]))

2.PNG3.PNG

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

2 REPLIES 2
Community Support
Community Support

Hi @ss0102 ,

 

Column or Measure is al

Here's the formula for calculated column.

jan%_c = CALCULATE(SUM('Table'[Jan]),ALLEXCEPT('Table','Table'[Bldg],'Table'[New/Old]))/CALCULATE(SUM('Table'[Jan]),ALLEXCEPT('Table','Table'[Bldg]))

feb%_c = CALCULATE(SUM('Table'[Feb]),ALLEXCEPT('Table','Table'[Bldg],'Table'[New/Old]))/CALCULATE(SUM('Table'[Feb]),ALLEXCEPT('Table','Table'[Bldg]))

2.PNG3.PNG

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

Memorable Member
Memorable Member

Hi @ss0102 ,

 

Please try the below measures:

 

Calculating the % for the Row subtotal in Table matrix visual.PNG

 

JAN % = DIVIDE(CALCULATE(SUM('Table (2)'[JAN])),
                CALCULATE(SUM('Table (2)'[JAN]),ALLEXCEPT('Table (2)','Table (2)'[BLDG])),0)

 

FEB % = DIVIDE(CALCULATE(SUM('Table (2)'[FEB])),
                CALCULATE(SUM('Table (2)'[FEB]),ALLEXCEPT('Table (2)','Table (2)'[BLDG])),0)

 

Aiolos Zhao





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
secondImage

Congratulations!

We are excited to announce the Power BI Super Users!

Microsoft Ignite

Microsoft Ignite with Arun Ulag

Featured Session: Drive Data Culture with Power BI- Vision, Strategy & Roadmap. Register here https://myignite.microsoft.com #MSIgnite #PowerPlatform #Power BI ​

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

secondImage

The largest Power BI virtual conference

100+ sessions, 100+ speakers, Product managers, MVPs, and experts. All about Power BI. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors