cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
amanuit
Regular Visitor

Conditional column and the value matching from different table.

I am trying to add a column and the value will depend on data from different sheets. Like i have imported two sheets 1 and 2.

 

and trying to add a column that if value of column A in sheet1 is available in sheet2's coulmn A then return NO else YES but when i am trying to write below equation, i am not able to add 'Sheet2'[A].

 

New_Updated = IF(Sheet1'[New]=".",".",IF(ISERROR(IN('Sheet1'[A],'Sheet2'[A], 0)),"YES", "NO"))
 
Can you please help me, Do i need to create some relationship?
 
1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Hi  @amanuit ,

I created some data:

sheet1:

vyangliumsft_0-1660024060361.png

sheet2:

vyangliumsft_1-1660024060362.png

Here are the steps you can follow:

1. Create calculated column.

Column =
IF(
    'sheet1'[column A] in SELECTCOLUMNS('sheet2',"column A",'sheet2'[coulmn A]),"YES","NO")

2. Result:

vyangliumsft_2-1660024060363.png

If you need pbix, please click here.

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

6 REPLIES 6
v-yangliu-msft
Community Support
Community Support

Hi  @amanuit ,

One of your Values is of Type Text and the other value is of Integer, and you need to convert it to the same type so that you can compare.

vyangliumsft_0-1660642554112.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

v-yangliu-msft
Community Support
Community Support

Hi  @amanuit ,

I created some data:

sheet1:

vyangliumsft_0-1660024060361.png

sheet2:

vyangliumsft_1-1660024060362.png

Here are the steps you can follow:

1. Create calculated column.

Column =
IF(
    'sheet1'[column A] in SELECTCOLUMNS('sheet2',"column A",'sheet2'[coulmn A]),"YES","NO")

2. Result:

vyangliumsft_2-1660024060363.png

If you need pbix, please click here.

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

I am trying to match value of sheet1 with Sheet2.

My value is in format of SR-324, PR-423.

Getting error message, "DAX Comparison do not support comparing value of type Text with value of type integer, consider using the value or Format function to convert one of the values", How can i solve this?

amanuit
Regular Visitor

Hello Amit, Thank you for reply.

I am not able to enter table1.

I am getting error that column Table1[A] either does not exist or doesnot have a relationship to any table available in the current context.

I also tried to create relationship between two table, many to many.

 

 

 

amitchandak
Super User
Super User

@amanuit , If you want to check if the value is there in another table or not

 

A new column in table 1

= var _cnt = countx(filter(Table2, Table2[A] = Table1[A]) , Table2[A])

return

if(isblank(_cnt), false() , true())

 

refer 4 ways to copy data from one table to another
https://www.youtube.com/watch?v=Wu1mWxR23jU
https://www.youtube.com/watch?v=czNHt7UXIe8



Features || Datamarts: https://youtu.be/8tskWsJTEpg || Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Learn Power BI P&L Statement || Time Intelligence Decoded : https://youtu.be/aU2aKbnHuWs&t=145s ||
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Dashboard of My Blogs !! Connect on Linkedin !! Subscribe to my youtube Channel !!!! How to get Quick Help !!
Resources | Master Power BI !! Expertise Power BI !! Power BI For Tableau User !!

Hello Amit, Thank you for reply.

I am not able to enter table1. when i try to select table 2, it is not showing in dropdown

I am getting error that column Table1[A] either does not exist or doesnot have a relationship to any table available in the current context.

I also tried to create relationship between two table, many to many. I think some issue in relationship, not able to resolve, can you please help me

Helpful resources

Announcements
November 2022 Update

Check it Out!

Click here to read more about the November 2022 updates!

Difinity Conference

Difinity Conference 2022

Difinity is the largest Microsoft Data, AI, Power BI, Power Platform and Business Applications Conference in New Zealand.

European Share Point Conference

European Share Point Conference

This conference returns live and in-person in Copenhagen this 28 November-01 December with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Microsoft 365 Conference â__ December 6-8, 2022

Microsoft 365 Conference - 06-08 December

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.