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

Differences between two columns from different tables

Hello, I am trying to figure out how can I create a measure that list (and eventually counts its elements) the differences between two columns from different tables where certain filters were applied.
result from filter table 1:

3
85
86
719

result from filter table 2:

3
4
5
67
82
85
86
90

expected result 1:

4
5
67
82
90

expected result 2: 5 different elements
Thanks in advance!

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

Hi, @talaespinosa 

It is recommended to use calculated table rather than mesaaure to display the result.

Please try formula like:
Calculated Table:

Result1 = 
 var filter1=SELECTCOLUMNS(FILTER(Table1,<filter1>&&<filter2>....),"column",Table1[Column1])
 var filter2=SELECTCOLUMNS(FILTER(Table2,<filter1>&&<filter2>....),"column",Table2[Column2])
 return  EXCEPT(filter2,filter1)

Measue:

Result2 = 
 var a1=COUNT(Result1[column])
 var b1=CALCULATE(DISTINCTCOUNT(Table2[Column2]),FILTER(Table2,<filter1>&&<filter2>))
 return b1-a1&":"&a1

If it doesn't work, please share a sample file for further research.

Best Regards,
Community Support Team _ Eason

View solution in original post

2 REPLIES 2
v-easonf-msft
Community Support
Community Support

Hi, @talaespinosa 

It is recommended to use calculated table rather than mesaaure to display the result.

Please try formula like:
Calculated Table:

Result1 = 
 var filter1=SELECTCOLUMNS(FILTER(Table1,<filter1>&&<filter2>....),"column",Table1[Column1])
 var filter2=SELECTCOLUMNS(FILTER(Table2,<filter1>&&<filter2>....),"column",Table2[Column2])
 return  EXCEPT(filter2,filter1)

Measue:

Result2 = 
 var a1=COUNT(Result1[column])
 var b1=CALCULATE(DISTINCTCOUNT(Table2[Column2]),FILTER(Table2,<filter1>&&<filter2>))
 return b1-a1&":"&a1

If it doesn't work, please share a sample file for further research.

Best Regards,
Community Support Team _ Eason

lbendlin
Super User
Super User

You are missing 719 from the first table.

 

Pseudo code:

 

UNION(EXCEPT(Table 1, Table 2),EXCEPT(Table 2, Table 1))

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.