Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hopefully this makes sense, but I am trying to search in column B (my codes) to see if it contains any specific combination of codes from columns A & B from a different table. For example, ID: 11111111 contains codes 12345 & 10112 so thats a match. ID 2222222 contains codes 88373 & 12345 so thats a match. ID 3333333 contains codes 97478 and B5768 so thats a match.
There are over 400,000 different combinations and I am searching 100,000s of rows.
Any tips would be appreciated!!
Hi @PowerBI123456 ,
Create a measure as below:
Match =
var a =SEARCH(MAX('Table (2)'[Column 1 code]),MAX('Table'[Codes]),1,0)
var b=SEARCH(MAX('Table (2)'[Column 2 code]),MAX('Table'[Codes]),1,0)
Return
IF(a<>0&&b<>0,"match","Not found")
And you will see:
For the related .pbix file,pls click here.
@PowerBI123456 have updated with correct syntax (it had some ) in wrong places)
I'm thinking something like this could work as calculated COLUMN in Table1:
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com
@AllisonKennedy good solution but my only concern will be the performance given the # of rows. @PowerBI123456 let us know if @AllisonKennedy solution performed ok, if not then I have some ideas which I would like to try but first let's try the solution you have in place. Maybe this is a good solution.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Thanks so much! However, when I tried using that formula, its been running for over 15 minutes now, and still running.
Anyway to do this faster? Also, any way to bring back what the match was?
@parry2k You're up - keen to hear your thoughts on optimization.
@PowerBI123456 what do you mean by bring back what the match was? Do you just want a text value of Column1, Column 2?
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com
@AllisonKennedy - yes, anyway to know what the value was from column 1 and column 2?
@Anonymous Thanks a lot! But its not working for me, I am not getting any matches even though I know there are some.
@parry2k would love to hear your thoughts on optimizing.
Thanks everyone!!
Hi @PowerBI123456 ,
What will return if you use below dax expression:
Match =
var a =SEARCH(MAX('Table (2)'[Column 1 code]),MAX('Table'[Codes]),1,0)
var b=SEARCH(MAX('Table (2)'[Column 2 code]),MAX('Table'[Codes]),1,0)
Return
a&" "&b
Show me your screenshot..
And have you checked my .pbix file?Can you find the reason why my side has shown the correct result while your side returned error?
@Anonymous Should this be a measure or a column?
This is a measure.
What I suggested in the last reply is also a measure,never copy it in a calculated column,otherwise you will get blank values.
@Anonymous Thanks, but I think the reason why its not working for me is because the column 1 and column 2 have duplicate codes in my file. For example:
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
107 | |
93 | |
77 | |
65 | |
53 |
User | Count |
---|---|
147 | |
106 | |
104 | |
87 | |
61 |