Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
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).
My data looks like this: (I populated these rows with random numbers)
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!!!
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!!!
Hi @poodlebunny ,
Below is my table:
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:
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.
User | Count |
---|---|
97 | |
73 | |
69 | |
43 | |
23 |