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
Anonymous
Not applicable

Power BI Desktop

Hi,

 

I need some assistance to write a formula to compare two columns in different tables in Power BI

1 ACCEPTED SOLUTION
Nathaniel_C
Community Champion
Community Champion

Hi @Anonymous ,
Do you mean like this?
difTable.PNG

excepttable = except(values('Table2'[Country]),values('Table1'[Country]))

This shows those countries in table 2 that are not in table 1.


Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Nathaniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

5 REPLIES 5
Nathaniel_C
Community Champion
Community Champion

Hi @Anonymous ,
Do you mean like this?
difTable.PNG

excepttable = except(values('Table2'[Country]),values('Table1'[Country]))

This shows those countries in table 2 that are not in table 1.


Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Nathaniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

Hi @Nathaniel_C ,

 

Thanks for your help. I got my resolution, but this query also works:

 

excepttable = except(Table2,Table1)
 
I got this as output:
Pooja_Mishra_0-1637523790408.png

It resolved my query. Thanks for your help again!!!

Nathaniel_C
Community Champion
Community Champion


If you would share your pbix, or dummy up some values in Excel both for current and expected data. Please copy and paste them into your post, rather than doing a picture, we may be able to help you. 

Please read this post to get your question answered more quickly:

https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

Nathaniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

Hi Nathaniel,

 

Thanks for your response. Here, is the dummy data:

 

Table 1:

 

PrefixCountryCount
AABC2
BFHG4
CKJL5
DSGH6
EYUI4
FKJH9

 

Table 2:

PrefixCountryCount
AABC2
BFHG4
CKJL5
GBNM3
DSGH6
HJKL8
EYUI4
FKJH9

 

I need to write a formula to compare two columns (Country) from the above 2 tables in Power BI

Hi @Anonymous , not sure what you mean when you say compare two columns.  Do you mean how many more countries are in table 2?
If so, try this:

More Countries in T2 compared to T1 =
VAR _t1Country =
    COUNT ( Table1[Country] )
VAR _t2Country =
    COUNT ( Table2[Country] )
RETURN
    _t2Country - _t1Country

tcompare.PNG


Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Nathaniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.