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
HarryMac
New Member

Column level totals for multiple values in each row

Hi,

 

I am using a matrix to display some data.

I have one column for months, rows for parent category and sub category and values for quantity of item, price of item and a measure for sum(quantity) * sum(price per item).

 

Capture1.PNG

 

Above is what it looks like without the measure column.

Below is with measure, the measure however for totals shows the wrong value. Is there an easy way of creating a total for each month in the matrix itself.

 

Capture2.PNG

 

Thanks,

H

3 REPLIES 3
CoreyP
Solution Sage
Solution Sage

Try this:

 

IF(ISFILTERED('Table'[Parent Category Name]) , [Qty]*[Price per Item] , SUMX('Table', [Qty]*[Price per Item] ))

Thanks CoreyP but unfortunately I can't get that working.

The Table structure the matrix uses is as follows;

 

Category

IdNameParentCategoryName (Self Referencing to Category Id)

 

Product

IdCategory IdNamePrice Per Item

 

Amount

IdProduct IdDate Wanted (Month)Quantity

 

Thanks

H

Yeah, you'd just need to edit it with your specific table names.. so something more like this:

 

IF( ISFILTERED('Category'[ParentCategoryName]), SUM('Amount'[Quantity]) * SUM('Product'[Price Per Item]) , SUMX('Category' , SUM('Amount'[Quantity]) * SUM('Product'[Price Per Item]) )

 

This is basically saying, if the measure is in the context of a parent category name, do one operation, and when it's outside of that context, aka the total line, do a sum of the measure.

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.