cancel
Showing results for 
Search instead for 
Did you mean: 

Slicer to Select Number of Words to be Displayed in a WordCloud in Power BI

WordCloud custom visual in Power BI gives a great way to visualize the most occurring words in the data. The size of the word depends on how frequently it appeared in the data-set. One can limit the number of words to be displayed in WordCloud. The defualt setting displays 200 words in this visual.

But, have we ever thought of modifying this word limit without changing the underlying word-limit setting in the visual. Basically creating a slicer in the report and then changing the number of words to be displayed in the WordCloud.

This article here gives a workaround on how one can achieve this functionality in Power BI.

 

Let us consider a sample data where we have got words from the plays written by famous Shakespeare.

Not going much in detail in the data, we will take Column5 as the main column which has got list of words to be visualized in the WordCloud and ignore the other columns.

Pragati11_1-1600682003808.png

 

I simply drag Column5 on a WordCloud visual in Power BI and get the following:

Pragati11_0-1600681947160.png

 

The default setting for this visual is to show the Maximum number of words as 200; as shown below:

w1.png

I will modify this limit to just show me 150 words.

w2.png

 

Now we need a slicer on this page, so that I can modify the number of words by making a selection in the slicer, rather than changing the word-limit at the visual level settings.

 

Let us do some transformations in the Power BI Query Editor to achieve this.

In Power BI Query Editor, go to the data-set and right click on it to Reference option as shown below:

w3.png

 

This will just create a reference to the original dataset as shown below:

w4.png

I have just renamed it to "Shakespeare Plays Words Unique". You can rename it at your ease.

 

Now let us remove the other columns and just keep Column5 in this new referenced table.

w5.png

Now let us remove duplicate values from this column and keep only the distinct words:

w6.png

The next step would be to give these words a unique identifier. For this we will use ADD COLUMN and then an Index column:

w7.png

 

Once we create an index column, we get the following data:

w8.png

 

Now Close & Apply the above changes and go to Model section where we can see our data model:

w9.png

 

We see both our tables here and we create a relationship between them on Column5 column:

w10.png

Now we have created here is a One to Many relationship from the referenced table to the main table:

w11.png

Looking at the above relationship, the columns from the new referenced table can filter our original table.

 

Next step is quite simple. We move the INDEX column in a slicer as shown below and renme it to Select No. of Words for Wordcloud:

w12.png

 

As I have by default limited 150 words in the WordCloud visual, I go to this slicer and put a visual level filter to show me values from 1 to 150 as follows:

w13.png

 

Start changing the selection values in this slicer and you will see that the WordCloud visual changes and displays the number of words based on this slicer selection:

wordcloudgif.gif

 

Voila! We see how seamlessly we can modify the number of words to be displayed in the WordCloud visual.

 

Hope this article helps everyone.

 

- Pragati