Rajendra Gupta

How to create a Word Cloud generator in Power BI Desktop

October 11, 2018 by

In this article, we’ll look at how to create a Word cloud generator in Power BI Desktop, including importing data, customization and more.

In my last article, Power BI Desktop Interactive chord diagrams, we learned about customized visualizations in Power BI Desktop. These visualizations are free to install and we can use them with our data set and customize charts as per our requirements.

Overview

A Word Cloud is a visualization that draws an image from frequently appearing words in the data set. These words are arranged in a cloud shape. The size of the words in the cloud image is proportional to its frequency.

Below is an example of how Word cluster looks like (Image Courtesy – Wikipedia) Word Cloud sample image

We can use word clusters to display keywords, tags, etc. We can quickly locate the items in the Word Cloud based on the size and color of the word.

For example, in the above example, we can see that the fewer words are appearing in the larger font size that shows the most used keyword as per the conditions defined.

We can use Power BI Desktop to create an interactive visualization with control on the appearance of the word cluster on the text, size, color, number of words, background, rotation etc.

Importing Sample data

To create a word cloud generator, we’ll first need data. In this example, we will use sample data books.csv from GitHub. This data shows the title, author, genre and publisher details.

Sample Data to create Word Cloud

Click on Raw, copy and save the data into.CSV file. We will import this.CSV file to create the Word cloud generator in Power BI Desktop.

Now open Power BI Desktop and click on ‘Get Data’. Choose ‘Text\CSV’ source from the list.

Import data from Data Source - Text\CSV

Provide the location of the source data (books.csv) and click Open.

Import data from Data Source - Text\CSV

We can get a preview of the data here. If we do not want to make any changes in the data, then click on Load.

In this example, some of the fields contain blank values as well. Therefore, we do not want those blank values data to create a Word Cloud generator. Click on Edit

In this example, some of the fields contain blank values as well. Therefore, we do not want those blank values data to create our Word cluster. Click on Edit

Preview data that Imported data from Data Source - Text\CSV

In this example, some of the fields contain blank values as well. Therefore, we do not want those blank values data to create our Word cloud generator. Now click on Edit to make changes in the data.

This opens Power Query Editor. Click on the columns and uncheck the blank value option from the publisher column.

Edit data to create the Word Cloud

Similarly, uncheck the blank value from the ‘Author’ column.

Edit data to create the Word Cloud

Once we are done, click on ‘Close and Apply’

Save data changes to create data set

Now, we can see the fields in our dataset in the ‘Fields’ section.

View the data set in Power BI Desktop

Importing from Microsoft AppSource

We can get the Word cluster from the Microsoft AppSource. We can view a brief description and tutorial video clip on the page.

Word Cloud App in Microsoft AppSource

Click on ‘Get IT Now’ and click on continue to accept the terms and conditions. Please note you need to log in with a work account in order to install a Word cluster in Power BI Desktop.

Accept terms and conditions to download Word Cloud

Click on Download for Power BI

Download Word Cloud App for Power BI

Save the .pbiviz file into the desired location. We will use this file to import into Power BI Desktop.

Save Word Cloud App to desired location

Now in the Power BI Desktop, Click on custom visual section From File. We get a warning message that the custom visuals are not provided by Microsoft and we should consider security or compliance risks before proceeding.

Click on Import to move further.

Import Word CLoud file in Power BI Desktop

Caution message before installing Custom visuals.

Provide the path of the Power Bi visual file (.pbiwiz) downloaded earlier and click open.

Go to download Word Cloud Power BI file path

This imports the custom Word cluster visual and results in the following success message.

Import custom visual message

We can see below the icon for Word cluster in the visualization section of Power BI Desktop now.

Word Cloud icon in Visualization section of Power BI Desktop

Custom visualizations

Before we create the Word cloud generator, let us understand the sample data further. Put a check on the Author and Publisher columns and we can see both columns data on the left-hand side.

Create data set to create Word Cloud

Let us increase the font size of the data to view it properly. To do so, increase the font size from

Format > Column header > Text Size

Format > Values >Text Size

Format the font size to view the data table.

Data is now visible properly. Click on publisher column and select Count.

Change data view to reflect the count of the data.

This shows the count of the publisher for the authors.

View changes performed in data table

We can sort the data here easily. Simply, click on the column name and sort it in ascending or descending order.

Sort data count in the data table in descending order

Now, our data looks like below and we are now ready to create a Word Cloud generator from this.

View sort data count in the data table in descending order

Click on Word Cloud icon from the Visualization section and this draws a blank chart.

Create Word Cloud in Power BI Desktop

Drag the fields from the data set in the category and values section. Below we can see fields as

Category -> Authors

Values -> Publishers

This draws up the Word cluster based on the data we selected.

Drage the columns and View Word Cloud in Power BI

If we click on any particular word, it shows up the details of that particular author. However, as we can see, for author John , it just looked at the first name John and combined the data together.

View selected data in a table in Power BI Desktop

Similarly, we can change the value to Count of the publisher from the drop-down option.

Change in data set conditions to reflect in Word Cloud

By default, the Word cluster looks for the first word in the value section. It does not look the entire word as a single word. If we want to create a Word cloud generator for the complete name, go to General ->Word-breaking. By default, it is turned on. Move the slider and turn off the word breaking.

Make changes in conditions to take consideration of full word - Word breaking

We can now observe the Word cluster; this is now showing the complete name of the author. If we look at our data table, Steinbeck John is having the highest count and it reflects in the Word cluster. The font size of Steinbeck John is largest in the visual.

View Word Cloud after making change in Word breaking setting

Now if we click on it, we can see that only one row for it.

View a single record in Word Cloud

Stop Words

We normally use some common words, for example, a, an, the, etc. Sometimes we do not want these words to appear in the Word cluster since they are commonly used words and if our dataset contains these words, it would be difficult to get a true picture of Word cluster by showing frequently used words.

In the below example, we created a Word Cluster visual for ‘Title’.

Understanding Stop Words

We can see above, there are a few words (the, of) appearing in the visual and we do not want to show them in this Word cluster.

To exclude those words, go to format -: Stop Words.

Move the slider to turn on this feature and enable Default-Stop Words.

Default stop words removed commonly used stop words from the Word Cloud.

Remove Default stop words

We can see the below visual after we turned on Default-Stop Words.

Change setting for Default stop words

We can also specify words to exclude apart from the default stop words. For example, we want to exclude the word ‘Vol’ so specify ‘Vol’ in the words section as shown below

Define Custom Stop Words and view change in the Word Cloud

If we want to exclude multiple words, specify them with space. For example, in below visual, we excluded ‘Vol data’ keywords.

Define multiple Custom Stop Words and view change in the Word Cloud

Customization

  • Rotation: we can specify the min and max angle of rotation along with Max number of rotations.

    Go to the format section and Rotate Test. Change the desired property and observe the change in the Word cluster visual.

    Format Word Cloud - Rotate Text setting - Max number of rotations


  • Title: We can set the title of the Word cluster visual from the format ->Title section. If we do not want the title, turn it off.

    Title in Word Cloud visuals

    Specify the title, font colour, size, alignment and we can see that in the Word cluster visual.

    Specify font , color, alignment, Title in Word Cloud visuals

  • Background: we can change the background color of the Word cluster visual using this property. Go to Background in the format section

    Define Background  in Word Cloud visuals

    Turn it on and select the background color and transparency level.

    View Background  in Word Cloud visuals

Conclusion

Word Clouds in Power BI offers an interactive method to do the analysis for frequent used words, text with customization. In this article, we reviewed how to create a Word cloud generator with Power BI Desktop. Explore these techniques with your own data sets and enjoy clouding!

Table of contents

Power BI Desktop Interactive chord diagrams
Power BI Desktop Pulse Charts
How to create a Word Cloud generator in Power BI Desktop
Power BI desktop Mekko Charts

Rajendra Gupta

Rajendra Gupta

Rajendra has 8+ years of experience in database administration having a passion for database performance optimization, monitoring, and high availability and disaster recovery technologies, learning new things, new features.

While working as a Senior consultant DBA for big customers and having certified with MCSA SQL 2012, he likes to share knowledge on various blogs.
He can be reached at rajendra.gupta16@gmail.com

View all posts by Rajendra Gupta
Rajendra Gupta
PowerBI

About Rajendra Gupta

Rajendra has 8+ years of experience in database administration having a passion for database performance optimization, monitoring, and high availability and disaster recovery technologies, learning new things, new features. While working as a Senior consultant DBA for big customers and having certified with MCSA SQL 2012, he likes to share knowledge on various blogs. He can be reached at rajendra.gupta16@gmail.com View all posts by Rajendra Gupta

1,516 Views