Forum Discussion

ABmagic's avatar
ABmagic
Frequent Visitor
8 years ago
Solved

Word cloud multi-select intersection (AND instead of OR)

Hello,   I've been playing with the Word Cloud visualization and I'm wondering whether there's a setting that allows you to change the logic that's employed when selecting multiple words in the vis...
  • OwenAuger's avatar
    OwenAuger
    8 years ago

    I used a Splitter function Splitter.SplitTextByWhitespace() to add a column splitting each sentence into words. Then I expanded this column into new rows.

     

    Here is the query used in my dropbox link.

     

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WKslIVUhOLFEoKs0rVorVgQik5KejCuTmlxanIoRyK1FEYgE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Sentence = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Sentence", type text}}),
        #"Duplicated Column" = Table.DuplicateColumn(#"Changed Type", "Sentence", "Sentence - Copy"),
        #"Lowercased Text" = Table.TransformColumns(#"Duplicated Column",{{"Sentence - Copy", Text.Lower, type text}}),
        #"Added Custom" = Table.AddColumn(#"Lowercased Text", "Word", each Splitter.SplitTextByWhitespace([#"Sentence - Copy"])),
        #"Expanded Word" = Table.ExpandListColumn(#"Added Custom", "Word"),    #"Changed Type1" = Table.TransformColumnTypes(#"Expanded Word",{{"Word", type text}}),
        #"Removed Columns" = Table.RemoveColumns(#"Changed Type1",{"Sentence - Copy"})
    in
        #"Removed Columns"

    With real text data, I imagine you would need to clean up the text in various ways and remove punctuation.