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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
powerbimatrix
New Member

Substract 2 columns created through power bi matrix

Hi, i am sourcing data from a file which contains values in rows. for example

Info 1 Q1 2021    -5

Info 2 Q1 2021    -4

Info 1 Q2 2022    10

Info 2 Q2 2023   15

 

I used power bi matrix to create a view where the amounts are showed based on the slicer.

My intent is to display the difference between my 2 columns Q1 2021 and Q2 2022 within the Matrix knowingly that the columns Q1 2021 and Q2 2022 may change as they are selected based on the slicer. any help? 

thanks

1 ACCEPTED SOLUTION
v-jianboli-msft
Community Support
Community Support

Hi @powerbimatrix ,

 

Based on your description, I have created a simple sample:

vjianbolimsft_0-1680749043651.png

Please try:

Measure = IF(ISINSCOPE('Table'[Year]),SUM('Table'[Value]),CALCULATE(SUM('Table'[Value]),FILTER('Table',[Year]=2022&&[Quarter]="Q2"))-CALCULATE(SUM('Table'[Value]),FILTER('Table',[Year]=2021&&[Quarter]="Q1")))

Rename column subtotal:

vjianbolimsft_1-1680749081446.png

Final output:

vjianbolimsft_2-1680749103801.png

 

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-jianboli-msft
Community Support
Community Support

Hi @powerbimatrix ,

 

Based on your description, I have created a simple sample:

vjianbolimsft_0-1680749043651.png

Please try:

Measure = IF(ISINSCOPE('Table'[Year]),SUM('Table'[Value]),CALCULATE(SUM('Table'[Value]),FILTER('Table',[Year]=2022&&[Quarter]="Q2"))-CALCULATE(SUM('Table'[Value]),FILTER('Table',[Year]=2021&&[Quarter]="Q1")))

Rename column subtotal:

vjianbolimsft_1-1680749081446.png

Final output:

vjianbolimsft_2-1680749103801.png

 

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.