Today's post is a nice short one on the importance and helpfulness of 'Data category' in Power BI.
Data Category Power BI
Power BI allows us to categorize any of your columns to help the engine determine how to handle these values.
Data categorization is primarily useful for:
- Mapping correct locations
- Web URLs
- Images
If you set the data categorization properly in Power BI, you can get accurate and interactive visuals.
Example 1: Georgia (the Country)
In our Olympics report, Georgia have won a few medals. Obviously this is Georgia the country, not Georgia the city. It would be nice if Power BI could read our mind, or look in the column at the other values and decipher that most of them are also countries, and pick Georgia the country. Unfortunately, it seems to have a large bias for North America.
In order to demonstrate this, I have changed the color for Georgia to red in the visuals below, to make it easier to spot.
Without data categorization
Georgia is plotted in the United States, as the state of Georgia.
With data categorization
When we set the Data Category for the 'Team' column to 'Country' (careful not to choose County!!! look for the 'R'), it's plotted correctly.
Example 2: Web URL in Matrix header
Web URLs in Power BI are a bit tricky. They must start with https in order for Power BI to allow and recognize them. Tables give you the ability to conditionally format any value as a 'Web URL'. This is pretty cool, as it enables us to display one value but link to the underlying URL. You can see this in the images below with the number - each one is underlined because they are a hyperlink to that Olympic Games web page. Conditional formatting with web URLs will work when the column is categorized or not, as long as it is text and has the https.
In the matrix row header however, this is a different story.
To display hyperlinks in matrix row headers, you can use the URL icon functionality. Simply turn 'On' the URL icon property in the 'Row headers' section of the matrix formatting:
Without data categorization
Here you'll see that the URL column displays the URL text of the column, even though I have turned the URL icon to 'On' in the matrix formatting.
With data categorization
When we set the Data category for the URL column to 'Web URL', the matrix row headers automatically update to the URL icon, thanks to the formatting we set earlier:
How to set Data Category
In conclusion, setting the Data category for your columns can be a very important step in getting the right results in your Power BI report. To set the Data category, simply select the column in Power BI Fields pane, then in the ribbon select the Data category you want.