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
Anonymous
Not applicable

Matrix visual column calculation

I have a matrix with column C , rows(column R with values R1,R2,R3 and R4) and amount measure. My matrix looks like below. Column C4 is the calculation I am trying to achieve. C4 = C3- (C1 + C2). C1,C2,C3,C4 are all labels and values of column C. I want to calculate amount measure for C4 such that it fetches corresponding amount for C1,C2 and C3 and perform the required calculation.

 

 C1C2C3C4
R1100200500200
R2200300600100
R3300400800100
R44005001000100
1 ACCEPTED SOLUTION
v-kelly-msft
Community Support
Community Support

Hi  @Anonymous ,

 

Create a measure as below:

 

C4 = 
VAR _sum=CALCULATE(SUM('Table'[Value]),FILTER('Table','Table'[C]="C1"))+CALCULATE(SUM('Table'[Value]),FILTER('Table','Table'[C]="C2"))
var _sum2=CALCULATE(SUM('Table'[Value]),FILTER('Table','Table'[C]="C3"))
Return
IF(ISINSCOPE('Table'[C]),SUM('Table'[Value]),_sum2-_sum)

 

And you will see:

Screenshot 2020-09-28 104318.png

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

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

View solution in original post

2 REPLIES 2
v-kelly-msft
Community Support
Community Support

Hi  @Anonymous ,

 

Create a measure as below:

 

C4 = 
VAR _sum=CALCULATE(SUM('Table'[Value]),FILTER('Table','Table'[C]="C1"))+CALCULATE(SUM('Table'[Value]),FILTER('Table','Table'[C]="C2"))
var _sum2=CALCULATE(SUM('Table'[Value]),FILTER('Table','Table'[C]="C3"))
Return
IF(ISINSCOPE('Table'[C]),SUM('Table'[Value]),_sum2-_sum)

 

And you will see:

Screenshot 2020-09-28 104318.png

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

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

amitchandak
Super User
Super User

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.