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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Pooja_Mishra
Helper I
Helper I

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
Super User
Super User

Hi @Pooja_Mishra ,
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
Super User
Super User

Hi @Pooja_Mishra ,
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!




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
Super User
Super User


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!




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 @Pooja_Mishra , 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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.