This is part 3 of the Getting Started with Power BI series.
Power BI is a powerful reporting and dashboarding tool; in which, organizations of all sizes can leverage to tell their data story. This series walks through the creation of building out a social media dashboard.
For Part 3, we will briefly touch on the visualizations, model editing, and creating a calculated measure.
Creating graphs and charts
After following the steps from Getting Started with Power BI Part 2: Getting Data of this series, we will end up back in Power BI Desktop with our list of fields and selection of visualizations on the right.
Prepackaged and import charts
Looking at the “Visualizations” section, the following charts are included prepackaged inside of PowerBI. You will be able to see the various charts and graphs already included by hovering over the icons and reading the tooltip. Your list will, at least, include the following options:
- stack bar/column charts,
- clustered bar/column charts,
- 100% stack bar/column charts,
- line chart,
- area chart,
- stacked area chart,
- line & stack column chart,
- line & clustered column chart,
- waterfall chart,
- scatter chart,
- pie chart,
- tree map,
- map,
- table,
- matrix,
- filled map,
- funnel,
- gauge,
- cards,
- kpi,
- slicers,
- donut chart,
- R – studio (enter R code),
- Or you may Import other charts created, by people in the community, from the visual gallery https://app.powerbi.com/visuals/ .
Let’s see how many likes we have. To get a basic total, let’s add a single card and select the LikesCnt checkbox.
I’m not a fan of the text title, so we have two options.
- We could rename the column. By clicking on the ellipse to the right of the name, there you are given some options, one of which is to rename the column.
2. We could reformat the card by clicking on the paint brush icon.
By turning off the Category Label, and adding a Title instead. I’ve also changed the default color of the text, alignment and font size.
Adding a Measure
I’m now curious, what is my “like” ratio compare to my post count? On the left, you will notice Power BI separating the Report, Data, and Relationship. By clicking on the Data (table icon), we can do more manipulation of the data.
You will be brought to a table-excel like version of all the data. To calculate the ratio, I will need to add a new Measure. Click on the “New Measure” icon on the right.
I’m going to call and define my new measure as:
This will add a new field that can be seen on the visual editor, but first we have to fix another issue for this measure to work correctly.
Modeling
The LikesCnt and CommentCnt are seen as Text and should be numbers, especially if we want our new Measure to work.
Just go to the modeling tab.
There you can change the Data Type to Whole Number for both columns. A warning should pop-up stating that changing the data type will change how the data is stored.
Now going back to the visual designer, you should now see the new measure in the fields list.
Now, selecting that field, you will see in the Modeling tab, this field is being formatted as text, just change Text to Decimal with 1 or 2 decimal places.
Now reset or recreate the card to use the ratio and any other formatting and style you may want on that card.
In Part 3, we briefly went over simple styling and editing, basic model edits of the data and creating a simple measure using Data Analysis Expressions (DAX). If you want more than a very basic touch on DAX, I would suggest checking out this Data Analysis Expressions (DAX) Reference article to learn more about other DAX concepts and formulas.