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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Syndicate_Admin
Administrator
Administrator

Subtract from two selected columns

Good afternoon

I would like to draw a graph in which the line obtained is the subtraction of two selected columns. Should you do it with DAX? Taking into account that you must change depending on the columns you select.

cdoblare28_0-1665064346843.png

Thanks a lot.

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

Hi @cdoblare28 ,

You can refer the following links to get it:

Calculate Difference Between Two Columns in Power BI Matrix

Matrix Visual: Subtracting two Columns

2020 = SUMX(FILTER('Table','Table'[Year]=2020),'Table'[Value])

2021 = SUMX(FILTER('Table','Table'[Year]=2021),'Table'[Value])

Variance = [2021] - [2020]

yingyinr_0-1665134093797.jpeg

subtract two values in a graph

Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))

diff = SUM(Sales[Sales Amount])- [Year behind Sales]

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regard

Community Support Team _ Rena
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-yiruan-msft
Community Support
Community Support

Hi @cdoblare28 ,

You can refer the following links to get it:

Calculate Difference Between Two Columns in Power BI Matrix

Matrix Visual: Subtracting two Columns

2020 = SUMX(FILTER('Table','Table'[Year]=2020),'Table'[Value])

2021 = SUMX(FILTER('Table','Table'[Year]=2021),'Table'[Value])

Variance = [2021] - [2020]

yingyinr_0-1665134093797.jpeg

subtract two values in a graph

Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))

diff = SUM(Sales[Sales Amount])- [Year behind Sales]

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regard

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

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.