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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
mahendi
Helper I
Helper I

missing subtotal for running total in matrix

I have the following matrix and table, the subotal is missing in the running totals where the category is empty.

mahendi_0-1606258526545.png

 

CategorySub CategorySub Category 2AmountDate
11.11.1.1101/01/20
11.21.2.1101/02/20
11.31.3.1101/03/20
11.11.1.2101/04/20
11.21.2.2101/05/20
11.31.3.2101/06/20
22.12.1.1101/06/20
22.12.1.2101/05/20
22.22.2.2101/04/20
22.22.2.1101/03/20
22.32.3.1101/02/20

 

I used quick measure for running total - 

Amount running total in Category =
CALCULATE(
    SUM('Sheet1'[Amount]),
    FILTER(
        ALLSELECTED('Sheet1'[Category]),
        ISONORAFTER('Sheet1'[Category], MAX('Sheet1'[Category]), DESC)
    )
)
 
is there a way to display the running total in subtotal where the category has no values?
1 ACCEPTED SOLUTION

Don'@mahendi,

I think this has to do with the structure of the data, what I did was this:

  • A new column has been created that joins the category - subcategory - Subcategory2
ID_CAT = 'Table'[Category]&'Table'[Sub Category]&'Table'[Sub Category 2]
  • A new table has been created with the categories
IDCAT = SUMMARIZE('Table';' Table'[Category];' Table'[Sub Category];' Table'[Sub Category 2];' Table'[ID_CAT])

Now create the following measure:

Total Value = CALCULATE(sum('Table'[Amount]); FILTER(ALLSELECTED(IDCAT[Category]);IDCAT[Category]<= MAX(IDCAT[Category]))) 

Result below and in attach PBIX file.


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português





View solution in original post

6 REPLIES 6
MFelix
Super User
Super User

Hi  @mahendi ,

 

Do you want a sub total for every subcategory so looking at your data in January all subtotals show 1 on February first will show 1 next will show 2 and so on?


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português





yes correct @MFelix 

Don'@mahendi,

I think this has to do with the structure of the data, what I did was this:

  • A new column has been created that joins the category - subcategory - Subcategory2
ID_CAT = 'Table'[Category]&'Table'[Sub Category]&'Table'[Sub Category 2]
  • A new table has been created with the categories
IDCAT = SUMMARIZE('Table';' Table'[Category];' Table'[Sub Category];' Table'[Sub Category 2];' Table'[ID_CAT])

Now create the following measure:

Total Value = CALCULATE(sum('Table'[Amount]); FILTER(ALLSELECTED(IDCAT[Category]);IDCAT[Category]<= MAX(IDCAT[Category]))) 

Result below and in attach PBIX file.


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português





mahendi
Helper I
Helper I

@MFelix  Thank you for the suggestion but in this particular scenario the display sequence is important.

I am trying to display running total in the sub total rows. if a category is empty it should still carry the total from previous sub total as it is a running total.

Hi @mahendi,

 

Then the issue is with your formula you are only picking up values that are above the category you must use a sumx for the subtotals. 


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português





MFelix
Super User
Super User

Hi @mahendi ,

 

The calculation you have is correct based on the matrix setup and the measure.

 

In your measure you are picking all the values that are On or After your Maximum category value, looking at the image you have for category 1 subtotal the value 1 for category 2 there is no value so the Sub Total value for that category is blank and it cannot be 1.

 

Believe you are looking at the sub total at a different way, I have made some changes to the setup of the matrix and renamed the totals:

MFelix_1-1607686297053.png

 

Has you can see the lines that refer to subcategory is blanks.


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português





Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.