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
mmar141
Frequent Visitor

Finding the difference two sources from a single column.

Hello,

I need help with a measure to find the differences between two sources.   

 

My table looks like this

mmar141_1-1692637661446.png

 

 

And I'd need the measure to calculate the difference

like this

mmar141_0-1692637616358.png

 

Can anyone help?

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@mmar141 add following measures:

 

Sum Value = SUM ( Table[Value] )

Sum Source A = CALCULATE ( [Sum Value], Table[Source] = "A" )
Sum Source B = CALCULATE ( [Sum Value], Table[Source] = "B" )

Sum Diff = [Sum Source B] - [Sum Source A] 

 

Use these measures in the visual and you should be good to go.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

4 REPLIES 4
parry2k
Super User
Super User

@mmar141 these are 4 different measures, you have to add it one by one



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

parry2k
Super User
Super User

@mmar141 add following measures:

 

Sum Value = SUM ( Table[Value] )

Sum Source A = CALCULATE ( [Sum Value], Table[Source] = "A" )
Sum Source B = CALCULATE ( [Sum Value], Table[Source] = "B" )

Sum Diff = [Sum Source B] - [Sum Source A] 

 

Use these measures in the visual and you should be good to go.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Wow.  I was overthinking this.  Much appreciated!

I get the error 

The syntax for 'Value' is incorrect. (DAX(Sum Value = SUM ( 'Table'[Value] )Sum Source A = CALCULATE ( [Sum Value], 'Table'[Source] = "A" )Sum Source B = CALCULATE ( [Sum Value], 'Table'[Source] = "B" )Sum Difference = [Sum Source B] - [Sum Source A] )).

Difference = Sum Value = SUM ( 'Table'[Value] )

Sum Source A = CALCULATE ( [Sum Value], 'Table'[Source] = "A" )
Sum Source B = CALCULATE ( [Sum Value], 'Table'[Source] = "B" )

Sum Difference = [Sum Source B] - [Sum Source A]

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.