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
ONCKdata
Helper I
Helper I

Sum of selected rows in a Matrix

Hello All,

I have a table of students and their marks across subjects and tests:

PBI 1.PNG 

I have created a matrix in PowerBI as below:

PBI 2.PNG

 

Now, I want to add a custom row in matrix that gives sum of Geometry and Algebra marks, kindly help me.

 

Thanks.

1 ACCEPTED SOLUTION
quentin_vigne
Solution Sage
Solution Sage

 

Hi @ONCKdata

 

A simple solution came into my mind : 

Create a new column "Category"

 

Category = IF(OR(YourTable[Subject]="Geometry";YourTable[Subject]="Algebra");"Science";"Others")

Add it to the lines of your matrix and expand it to the level where it looks like that : 

 

matrix.PNG

 

- Quentin

View solution in original post

3 REPLIES 3
quentin_vigne
Solution Sage
Solution Sage

 

Hi @ONCKdata

 

A simple solution came into my mind : 

Create a new column "Category"

 

Category = IF(OR(YourTable[Subject]="Geometry";YourTable[Subject]="Algebra");"Science";"Others")

Add it to the lines of your matrix and expand it to the level where it looks like that : 

 

matrix.PNG

 

- Quentin

Hi,

Thank you very much for the reply.

 

Your solution solves the question I have asked, but can you tell me if there is way to mention difference of two rows?

 

 

@ONCKdata

 

To make a difference between two rows is very tricky and complicated, this is why I don't do it (example here : https://community.powerbi.com/t5/Desktop/How-to-calculate-difference-between-two-row-values/td-p/389...)

 

What I prefer to advice is to pivot / unpivot the needed rows so that they became column and can be comparable with a simple '-' 

 

 

- Quentin

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.