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
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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.