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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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