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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Sept PBI Carousel

Power BI Monthly Update - September 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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

Top Solution Authors