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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Difference between 2 columns in different table

Hello everyone,

 

I am facing issue in creating DAX for difference between 2 columns in different tables.

 

Table A and B has One to many relationship respectively.

 

Table A has columns - Project name, estimated spent

Project name : abc, def, geh

estimated spent: 2000, 3000, 4000

 

Table B has columns - Project name, actual spent

Project name: abc, abc, def, geh, def, geh

actual spent: 500, 400, 500,1000,1000,1000

 

I want visula to show data as:

Project name: abc, def, geh

Difference : 1100,1500,2000.

 

 

Please help in making DAX for it.

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi there.

 

-- measure 1 in table A

[Estimated Spend] :=
	SUM( TableA[estimated spend] )
	
-- measure 2 in table B

[Actual Spend] :=
	SUM( TableB[actual spend] )
	
-- measure 3 in table B

[Estimated - Actual] :=
	[Estimated Spend] - [Actual Spend]

-- TableB should be hidden and slicing should
-- happen by the attributes of TableA.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi there.

 

-- measure 1 in table A

[Estimated Spend] :=
	SUM( TableA[estimated spend] )
	
-- measure 2 in table B

[Actual Spend] :=
	SUM( TableB[actual spend] )
	
-- measure 3 in table B

[Estimated - Actual] :=
	[Estimated Spend] - [Actual Spend]

-- TableB should be hidden and slicing should
-- happen by the attributes of TableA.
Anonymous
Not applicable

@AnonymousThanks for the idea!!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors