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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Stuznet
Helper V
Helper V

How to Calculate Subtotal in a Rows

Hi Power Bi Community,

 

I'm struggling calculating the Subtotal in a rows. This problem is similar to this I have week ago. Thanks to @Greg_Deckler

https://community.powerbi.com/t5/Desktop/How-to-Calculate-Total-Column-When-is-Not-Displaying-the-To...

 

When I went to the paint roller and turned on the Subtotal, somehow it doesn't show me the subtotal in a row instead it displayed the Total per column and is wrong too.

 2018-10-02_12-54-15.png

 

I want the Total amount in a row. How can I write a formula or do I need to create a new measure?

2018-10-02_12-57-23.png

 

Col1 = SWITCH(TRUE(),
    
MAX('Table2'[Category]) = "A",
    CALCULATE(COUNT(Table1[Percent]),FILTER(Table1,[Buck]= "25%")),
    
MAX('Table2'[Category]) = "E",
CALCULATE(SUM(Table1[ABC]),
    FILTER(Table1,Table1[Buck] = "25%"),FILTER(Table1,Table1[Rank] = "Yes")),
    
MAX('Table2'[Category]) = "D",
CALCULATE(SUM(Table1[ABC]),
    FILTER(Table1,Table1[Buck] = "25%"), FILTER(Table1,Table1[Rank] <> "Yes")),
    
MAX('Table2'[Category]) = "C",
FORMAT(DIVIDE([INF],[TotalSumABC]),"0.0%"),

MAX('Table2'[Category]) = "B",
CALCULATE(SUM(Table1[Amt]),FILTER(Table1,SEARCH("25%)",[Buck],1,0))),

MAX('Table2'[Category]) = "F",
CALCULATE([INF] - [Value]),

MAX('Table2'[Category]) = "G",
FORMAT(DIVIDE([VAR],[Value]),"0.0%"))

 

 

1 ACCEPTED SOLUTION

Presuming you are using a matrix visual, you will need to create a 3rd measure that is the sum of Col1 and Col2

 

TotalCol = [Col1] + [Col2]

Then put TotalCol in your visual next to Col1 and Col2

Capture.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

If, instead, Col1 and Col2 are values from the data (for example year, location, etc), you can put that field in the "Columns" of the matrix and you will get the option to turn column values on or off.

 

Hope this helps

David

 

 

View solution in original post

4 REPLIES 4
dedelman_clng
Community Champion
Community Champion

You can create a measure that adds Col1 and Col2.  The only way to have the visual provide column subtotals is to have columns defined for the matrix (as opposed to just multiple measures as in your case).

 

Hope this helps

David

@dedelman_clngI'm not certain what did you meant by that. Could you show me? 

Presuming you are using a matrix visual, you will need to create a 3rd measure that is the sum of Col1 and Col2

 

TotalCol = [Col1] + [Col2]

Then put TotalCol in your visual next to Col1 and Col2

Capture.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

If, instead, Col1 and Col2 are values from the data (for example year, location, etc), you can put that field in the "Columns" of the matrix and you will get the option to turn column values on or off.

 

Hope this helps

David

 

 

Thank you 🙂

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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