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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
poodlebunny
Regular Visitor

Subtracting columns in matrix with 2 slicers

Hi everyone,

I've a dataset with some categorical variables (AGE, SEX, SOURCE, YEAR) and the numerical variable is 'VALUE'. 
I've 2 slicers: SOURCE and YEAR.   In the matrix, the rows are YEAR, AGE, SEX, and SOURCE. 

I'd like to add a column to my matrix:   

total of VALUE for source 1 -  total of VALUE for source 2.   (e.g. the first row will have 42-53=-9). 

 

poodlebunny_2-1713987504654.png

 

 

My data looks like this:   (I populated these rows with random numbers) 

poodlebunny_1-1713987276987.png



 

I spent many hours on this but did not have any luck so far, I would really appreciate any help I can get! I was able to get this to work with only one slicer but not with 2 slicers.

 

Thank you!!! 

2 REPLIES 2
poodlebunny
Regular Visitor

hi Xianda, thanks a lot.  Is there a way to do it based on the slicer values? (e.g. instead of hard coding it as 1 or 2, I would want it to be populated with whatever I choose in the slicer.) Thank you!!! 

Anonymous
Not applicable

Hi @poodlebunny ,

Below is my table:

vxiandatmsft_0-1714010935602.png

The following DAX might work for you:

Measure = 
  var Source1 = CALCULATE(SUM('Table'[Value]),'Table'[Source] = 1)
  var Source2 = CALCULATE(SUM('Table'[Value]),'Table'[Source] = 2)
  RETURN
    Source1 - Source2

The final output is shown in the following figure:

vxiandatmsft_1-1714010970751.png

Best Regards,

Xianda Tang

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

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Kudoed Authors