Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hello Community!
I am relatively new M Langauge and I want to know how to check if the string exists in another column. I have used an Excel formula such as: isNumberMatch
I will elaborate on my question further to provide some context.
I have two queries:
Query 1 contains my source data which has every detail.
Query 2 is another table that contains data.
I have done a string concatenation in both queries, meaning, i have joined, FirstName, LastName and EmailAddress.
In query 2, I want to create a custom column which checks if the concatenated column in Query 2 matches the concatenation in Query 1.
I have tried to do this but I don't know how to reference a column in another query:
if Table.SelectColumns(#"NHSP Data Edit","Concat") = Table.SelectColumns(#"Daily SiP - Edit","Concat") then "true" else "false"
Thanks for your help!
Solved! Go to Solution.
Hi @qasimawan ,
sorry, yes, the code has to be adjusted:
if List.Contains(#"query1"[Concat], [Concat]) then "true" else "false"
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
Hi @qasimawan ,
sorry, yes, the code has to be adjusted:
if List.Contains(#"query1"[Concat], [Concat]) then "true" else "false"
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
Hi Imkef,
Many thanks for your reply!
Unfortunately, I have ran into this error which I can't eliminate. I have added a change type step and manually changed the data types but the error hasn't gone away.
Here is the error message: Expression.Error: We cannot convert a value of type Table to type List.
Details:
Value=[Table]
Type=[Type]
Hi @qasimawan ,
if my understanding is correct, you want to check if a certain value in each row of a table (query2) is contained anywhere in the whole column of table from query1.
If so, you'd add a column in query2 like so:
if List.Contains( Table.SelectColumns(#"query1","Concat"), [Concat]) then "true" else "false"
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries