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
Hi, I have a column of text separated by a semi colon, e.g.
Col1
word1;word2
word1;word3
word3;
word4
word1
etc etc
I would like to count how many instances of each word in each row and have a total but comparing it against a table of possible words, result would be:
word 1 = 3
word 2 = 1
word 3 = 2
etc
I see an example here:
# Depression = CALCULATE(COUNTAX('TableName','TableName'[Emotional Depression]),'TableName'[Emotional Depression]="Depression")
But it is using a hard coded word to search for instead of a list in another table/column.
As I have 30 words to search for, would rather reference something else to supply statically in the search criteria.
Any suggestions pls?
thanks!
BB
Solved! Go to Solution.
Given the following Enter Data queries:
SearchWords
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WKs8vSjG0BpFGSrE6yHxjON/YGs40QShSio0FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [SearchWords = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"SearchWords", type text}}) in #"Changed Type"
Words
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WKs8vSjFUitWBsIzgLGM4y0QpNhYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Words = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Words", type text}}) in #"Changed Type"
Create this colum in your Words table:
Count = SUMX(SearchWords,IF(LEN(SUBSTITUTE(SearchWords[SearchWords],[Words],""))<LEN(SearchWords[SearchWords]),1,0))
You may first select Split Column By Delimiter in Query Editor.
Given the following Enter Data queries:
SearchWords
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WKs8vSjG0BpFGSrE6yHxjON/YGs40QShSio0FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [SearchWords = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"SearchWords", type text}}) in #"Changed Type"
Words
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WKs8vSjFUitWBsIzgLGM4y0QpNhYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Words = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Words", type text}}) in #"Changed Type"
Create this colum in your Words table:
Count = SUMX(SearchWords,IF(LEN(SUBSTITUTE(SearchWords[SearchWords],[Words],""))<LEN(SearchWords[SearchWords]),1,0))
Thank you, this is almost perfect. However my column of words I am searching for, is of format:
word1;word2
Which your suggestion doesn't match on unfortunately.
COUNTIF works nicely in Excel, is there an equivalent ?
Thank u so much!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
89 | |
86 | |
70 | |
51 |
User | Count |
---|---|
206 | |
150 | |
97 | |
78 | |
69 |