Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
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 visualization. For example, if I saw the word "phone" and "store", I may want to see all the comments that contain both of those words. However, right now, it is set up as an OR where it will pull in comments that contain either "phone" or "store".
This may be the default for most visualizations in Power BI, but wonder if there's a way to customize the logic that is being used.
Thanks!
Solved! Go to Solution.
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.
I realise this is an old topic, but it is almost exactly what I am looking for as well.
I have a large dataset with work hours logging with descriptions for each entry. I have then used an external algorithm to extract keywords, which are then added in a comma sepparated list, see the table below. I have a word cloud visual with Keywords as the category and Hours as the values.
Now, the problem I have with the proposed solution is that this would blow up my dataset, considering the average number of keywords is 6/7. Would anyone know a clever way of solving this without having a lot of duplicate lines? I thought of using the FIND() function, but my problem is that the ALLSELECTED() function will return [Updating, Requirements, Document] instead of just Updating when we select that word.
Date | Project | Hours | Description | Keywords |
20-07-2020 | Project X | 2.5 | Updating the Requirements Document | [Updating, Requirements, Document] |
Hi @ABmagic
You can do this creating an appropriate measure and using that to filter a 'sentences' visual.
See a dummy model here:
https://www.dropbox.com/s/499zocl05bk8bqk/Word%20cloud%20multi-select%20intersection.pbix?dl=0
I have a simple table called Sentences containing Sentence and Word columns.
Sentence | Word |
the cat runs | the |
the cat runs | cat |
the cat runs | runs |
the dog runs | the |
the dog runs | dog |
the dog runs | runs |
the mouse runs | the |
the mouse runs | mouse |
the mouse runs | runs |
my mouse runs | my |
my mouse runs | mouse |
my mouse runs | runs |
I created these two measures:
Word Frequency = COUNTROWS ( Sentences ) Sentence Count With All Words = VAR WordsSelected = ALLSELECTED ( Sentences[Word] ) RETURN COUNTROWS ( FILTER ( VALUES ( Sentences[Sentence] ), VAR WordsInSentence = CALCULATETABLE ( VALUES ( Sentences[Word] ) ) RETURN ISEMPTY ( EXCEPT ( WordsSelected, WordsInSentence ) ) ) )
The Sentence Count With All Words measure checks whether the Words corresponding to a particular Sentence at least include all Words selected, and counts all Sentences meeting this condition.
Then I created a Word Cloud visual using Word & Word Frequency and a table visual simply containing the Sentence field.
On the table visual, I added a visual level filter Sentence Count With All Words > 0.
Then selecting multiple words filters the table visual appropriately.
This works with my simple data model, but could require tweaking depending how your tables are set up.
Hope that helps 🙂
Regards,
Owen
Any quick ways to create the "word" column? I have over 1300 rows of comments that I'm working with.
Thanks!
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.
Thanks for this! I'll have to give this a try sometime! Thanks!
@ABmagic,
I am afraid that there is no method to customize the logic as you describe in Word Cloud custom visual, regarding to this issue, you can submit a feature request in Power BI ideas forum.
Regards,
Lydia
Is this the same for all visualizations within Power BI?
Thanks!
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
87 | |
87 | |
86 | |
67 | |
49 |
User | Count |
---|---|
134 | |
113 | |
100 | |
68 | |
67 |