March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe 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
I have two tables "Sentences" and "Words".
My goal is to add a calculated column/measure to the "Sentences" table, which contains the words that also occur in the Words table.
The "Sentences" table's both "text" and "id" collumns are calculated measures. The "Words" table is just simply imported.
The tables in the example are only examples, there might be more and different sentences, words in each table.
Right now, the two tables are not joined.
I would like to write a DAX function that would create the third collumn (highlighted with yellow).
Does anyone know a solution for this problem? I was thinking about taking the first sentence --> iterating through the Words table --> finding / not finding a match --> moving onto the next sentence --> iterating...........
Solved! Go to Solution.
Hi,
From the 1 column Words table, build a 3 column table with the original, English and Spanish columns. Modify my calculated column formula to:
Words found = CONCATENATEX(FILTER(VALUES(words[Words]),CONTAINSSTRING(sentences[text],words[English])),words[Words],",")
Hope this helps.
Hi,
This calculated column formula works
Words found = CONCATENATEX(FILTER(VALUES(words[Words]),CONTAINSSTRING(sentences[text],words[Words])),words[Words],",")
Hope this helps.
Hi @Ashish_Mathur,
Your solution works perfectly, however I forgot one important detail in my question. I need to find substrings from the "words" table as well. Example:
The matching substrings are followed by " - " and then another set of substrings are also present. (It is an English - Spanish dictionary).
Is there a solution for this problem?
Hi,
From the 1 column Words table, build a 3 column table with the original, English and Spanish columns. Modify my calculated column formula to:
Words found = CONCATENATEX(FILTER(VALUES(words[Words]),CONTAINSSTRING(sentences[text],words[English])),words[Words],",")
Hope this helps.
Thank you @Ashish_Mathur 🙂
After the VALUES function I had to pass the "Words" table and not the "Words[WORDS]" collumn.
You are welcome.
Probably a combination of containsstring, concatenatex, and, personally, selectcolumns.
selectcolumns(
'table sentences'
, "Id" , 'table sentences'[Id]
, "Text" , 'table sentences'[text]
, "Words"
, concatenatex (
filter ( 'table words'
, containsstring ( 'table sentences'[text] , 'table words'[words] )
)
, 'table words'[words]
, ", "
)
)
Haven't tried it, I may have missed misspelled something.
I have tried it, but unfortuanatelly received this error message:
Is there a different solution?
Looking at the accepted solution, your proposed of two tables in to one was meant as an addition on the first. I thought you wanted a third table.
If you would put what I wrote into a new custom table, it should work.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
114 | |
76 | |
57 | |
52 | |
44 |
User | Count |
---|---|
165 | |
116 | |
63 | |
57 | |
50 |