You are on page 1of 24

Power BI and visuals

This chapter explains the structure and the different versions of Power BI, and we'll
create reports with visuals in Power BI Desktop. 

1. Power BI

In the past, only specialized IT people could handle Business Intelligence. But the BI
tools have become more and more user-friendly, so that end users can also produce their
information needs themselves and share it with other employees or interested
parties. This is called Self-Service Business Intelligence . Power BI is such a tool that
makes this possible. There are three parts (layers) in Power BI: Power Query, Power
Pivot and Power View/Map, see figure 1.  

Figure 1

In the first part, Power Query, the ETL process takes place. Data can be selected from
more than a hundred different sources via so-called connectors. You can think of various
databases, whether or not in the Cloud, but also files from the internet, Excel files, e-
mail, Facebook or Big Data via Hadoop. If a connector is not available within Power BI,
such a connector can often be downloaded via a third party. For example, there is no
connector for Exact software by default. This connector is easy to download, so that the
data from Exact software can also be loaded into Power BI. Data must be transformed
into a desired form. Once the data has been transformed, it can be loaded into the data
warehouse.

The second part, Power Pivot, can simply be seen as the data cube. That data cube has a
data model (design of the tables, including their relations) and the data itself in the
tables. Here we have fact and dimension tables. An important part of Power Pivot is
enriching the data with calculated measures, so that you can create a specific report. For
example, you have the data (facts/measurements) gross price and discount percentage.
But you want to show the amounts of the net price in the report. You can then add a new
(calculated) net price measure to the data.      

The last part, Power View/Map, is to visualize the desired information need in graphs,
tables, geographical views or KPI meters.

In this course we use Power BI Desktop. This is free to download. 

The Power BI service can also be accessed directly at app.powerbi.com . In that Cloud
version of Power BI you can also load data and create reports, but this version is more
limited than the Desktop version. The reports that are published can be viewed or shared
in the Cloud version. There are also Power BI Pro and Power BI Premium (for large
companies). Only in the Pro or Premium version you can directly create dashboards and
share the reports. On a dashboard , parts (visuals) of different reports can be placed on
one new report. Dashboards can also be created from the reports that have been
published via Power BI Service.  

Figure 2

2. Visuals

2.1 Visuals with one table

Example 2.1

A jeweler has made some data available via a Comma Separated Values (CSV) file. A
CSV file is a text file with which tabular data can be exchanged between different
information systems. The data is separated by a specific character, usually a comma, but
a semicolon (;) is also commonly used.
Four visuals are created for the report.

Visual 2.1.1:

1. Launch Power BI Desktop. From the ribbon Home > group Data > Get data, Text /
CSV. Click on Connect, see figure 3. If visible, you can select Text/csv
immediately after Fetch data.            

The window Get Data are all sources that can be connect via an integrated
connector. Through that connection, data from the source is loaded into the Power BI
data warehouse.  

Figure 3
2.Select the file Jeweler.csv and click Open. A preview of the data being loaded is
shown. At the top you can see that the separator is semicolon (;). The table has four
columns, ArticleNumber, Category, Gender, and Description. This step is the Extract of
the ETL process.         

3.There are three options: Load, Transform Data, Cancel. Click Transform Data. In 


Load, data is directly loaded into the data warehouse of Power BI.         

4. We enter the Power Query section of Power BI, see Figure 4. This step is the
Transform of the ETL process.

5.In this window you can, for example, delete columns or certain rows. In this example,
we want to keep all data, so there is no need to transform the data (ETL process). We do
change the name of the table  Jeweler in Article. This can be done on the right-hand side,
under Properties.   

Figure 4

6. Important to know is that columns have a data type. There are several numeric data
types, such as Integer or Decimal number. There is also a Text data type and a Date data
type , with or without the time format. There is also a True/False data type, also known
as Yes/No, On/Off or Boolean . In this, the well-known check marks are stored in
information systems (Passed, In possession of a driver's license, Insured,
Completed). There are other data types, but they depend on the database type. All data in
the column must be of the same type. The data type can be viewed or changed by
selecting the entire column (click on the column header). In the ribbon Transform >
group Any Column > Data Type, the Data Type is visible. The data type of
the ArticleNumber field is Integer, that of the other three  columns is Text.                      

The icon next to the column name also indicates the data type. If you click on the icon
you can also change the data type.
7. Click in the ribbon Start > group Close > Close & Apply. The data is loaded into the
Power BI data warehouse. This step is the Load of the ETL process.    

8.We come to the main Power BI window, see Figure 5. It has three panes on the
left: Report, Data, and Model.     

9.Select the Data pane . The table with the data is displayed. If there are several tables,
the desired table can be selected on the right.  

10.Select the Model panel . The data model is displayed. In this example, this is just a


table. If prompted to upgrade to a new model view, accept. 

Figure 5

11.Select the Report panel . The report view is displayed. The white part is called


the Canvas . The various visualizations (visuals) can be made on this. The available
visuals are shown on the right. Below that are two more important panels, Fields and 
Format (with a paint roller symbol). In the panel Format various settings can be adjusted
from the visual. At the far right are all the tables and the fields that are in the data
model.            

12. Click the visual Ring Diagram (Donut chart); it will appear on the canvas. We want
to see the number of articles per category in this diagram. Drag
the Category and ArticleNumber fields into the visual and make the visual slightly larger
to make it easier to read, see Figure 6.      
Figure 6

13.In the Visualizations pane, dragging has placed the Category field at the Legend and


the ArticleNumber field is at Values . You could also have dragged the fields directly
there.          

14. It is grouped per category, of each category only one value is shown. Select the
layout of the visual under Format (the paint roller). Select the group  Detail labels and
see at  Label style different options. Finally select the last option All detail labels. All
important data is now shown with the labels. Turn the Legend on to Off. The legend is
not needed now; After all, the labels of the donut chart contain the categories.            

15.The numbers at the labels are shown in trillions, for example the Earrings category ,
2bn (19%). The value 2bn stands for 2 trillion, which is a bit much. 

16.Click right in the panel Fields > Values on ArticleNumber, as shown in Figure 7.     


Figure 7

17.The ArticleNumber field has an integer data type . Numbers are summed by


default. However, the article numbers should not be added up, but counted. In the list,
choose the Count option , see figure 7. The article numbers are now counted per
category. By the way, it doesn't matter which field you count; you could also have
dragged Gender to Values . Gender has as data type Text and is automatically counted
on.           

18.Now the Earrings category says 1.54K (19.19%). That K stands for kilo, so x 1000.


Large numbers are automatically abbreviated, but that can be adjusted. Choose None in
Format > Detail labels > display units. The actual values are now shown. By default, that
value is set to Auto(matic). Change in the same group the Text Size of the labels
to 12pt.              

19.In Format > Data colors you can manually select a different color for each
category. However, we leave it at the chosen colors.    

20.In Format > Title change the title to Number of articles per category and center the
title at Alignment . Make the title slightly larger by increasing the Font size
to 16pt.           

Visual 1.2:

1. We immediately create a second visual in the same canvas. Make sure the Donut


Chart visual is not selected! Click anywhere in the blank area of the canvas, otherwise
the Donut chart visual will be automatically replaced with your new visual. Select the
visual Stacked bar chart. Place it to the right of the donut chart. Drag
the Category and ArticleNumber fields into the new visual. Regroups by category. The
X-axis again shows trillions. The article numbers are again summed per category. Make
sure the item numbers are counted instead of summed.          

2. Switch Format > Data label to On. The result of the count is immediately visible at the
end of the bars. In that group all kinds of settings can be made, such as the  Label
position of the data label.        

3.The X-axis is no longer needed. Make sure the X is turned off.  

4.Make sure that the categories are shown in 12pt (located under Y-axis ), and that the
title is shown in 12pt , centered and changed to Number of articles per category. Also
show the labels in 12pt , see figure 8.         

Figure 8
Visual 1.3:

1. We immediately create a third visual in the same canvas. Click anywhere in the blank
area of the canvas so that no visuals are selected, and place a Table visual below the
donut chart.  

2.Place all fields from table Article into the visual Table. All fields are now in
the Fields pane under Values . There you can change the order of the fields in the table
by dragging.        

3.Choose Format > Style > Alternating rows.      

4.Give the values in the table visual a font size of 12pt, via group Grid, see figure 9.   

Figure 9

5.The sum of numeric fields is shown by default on the last line of the table visual. For
article number that is complete nonsense. Turn Off Format > group Total > Totals.        

6.Note that Table is also grouped in the visual . Nevertheless, all values are now
shown. This is because the ArticleNumber field is in the table. ArticleNumber is the key
(PK) of the table, so all values are different, so no grouping. But if
you remove the ArticleNumber and Description fields from the table visual, for example,
the grouping is immediately visible in the table visual. Remove goes through Fields >
Values

Visual 1.4:
1. We make one last visual, a Matrix. That's one of the most important visuals. In Excel
it is called the pivot table.  The name of the second step within Power BI, Power Pivot, is
derived from this. Many analyzes are made using matrices (pivot tables). If necessary, a
matrix provides very compact analytical information from billions of rows of data. In a
table we have only rows, but in a matrix we have rows and columns. Place
the visual Matrix in the canvas (click on an empty spot in the canvas first) next to the
table visual.   

2. Drag the Category field to Rows in the Fields pane . All categories are shown


(grouped). Drag the ArticleNumber field to Values in the Fields pane . The article
numbers are again summed per category by default. Make sure the item numbers are
counted. This is called a one-dimensional slice. The numbers are shown based on
the Category dimension .              

3.Now we are going to add a second dimension and that immediately shows the power
of a matrix. Drag the Gender field to Columns . We now assume that you know
that Columns are in the Fields panel . The numbers are immediately shown per category,
per gender (two dimensions), including the totals, see figure 10. If the totals (or
subtotals) are not desired, they can be disabled in the settings Grand
Total and Subtotals of the visual.            

Note that different filters are active for each value in the matrix. For example, for the
first value, 829, the underlying dataset has a filter active on Ladies and Bracelets. The
number of ArticleNumbers for that filter is counted. But that applies to all values in the
matrix, including the totals. A total of 75 (5 × 15) different filters are active in the
matrix. Within BI, the term filter context is used for this. The value in a cell (calculated
measure) depends on the filter context. Of course, this does not only apply to the
visual Matrix, but to all visuals.  

Figure 10
4.Choose Format > group Style > Bold header, and make sure that the values in the array
of visual font size 12pt shown through group Grid (Grid).          

5. We immediately made a nice report of our data by visualizing it in four visuals, see
figure 11. The page with the visuals is full. If you want to create more visuals, a new
page can of course be created and the different pages can be given an appropriate name.

Figure 11

6. Finally, the great power of Power BI, filtering. In the Donut


chart visual, select the Earrings category . The Earrings category is now being
filtered . The three other visuals are automatically filtered by the selected category as
well. Now hold down the Ctrl key (multiple selection) and also click on
the Bracelets category in the Donut Chart visual . The Earrings and Bracelets categories
are now filtered.By clicking in a white part of a visual (or clicking on the selected value)
you cancel the filter. Of course you can also filter in the other visuals. Remove the filter
and click on the gender Ladies in the visual Matrix.             

7. Exit Power BI and name it Jeweler. The file will have the extension .pbix (Power BI
Xml).   

2.2Visuals with multiple tables

In this section we will practice with several tables between which a relationship has to be
established. We also practice with visuals with maps.

Example 2

The data on the export of bell peppers within Europe is collected.


Three visuals are created for this report.

Visual 2.1:

1.Open a new Power BI environment. From the ribbon Home > group Data > get Data >
Excel. Click Connect. Excel can also be selected directly, as the file format is often used
when exchanging data between information systems.       

2.Select the Excel file Paprika export.xlsx. This Excel file has two
tabs, Country and Paprika. If you select it, a preview of the data will be shown. Place a
checkmark in both tabs and choose Load. Data does not need to be adjusted.      

3.Select the Model pane . You see the two tables, but there is no relationship between the
tables yet. The relationship is based on country codes, key in table Country and foreign
key in table Paprika. In table Paprika the country codes are in column Code country and
in table Country in column Country code. If the field names are identical (eg Country
code), Power BI automatically establishes the relationship between the two tables. But if
you load data from multiple sources, 'relationship columns' can have completely
different field names. For example, customer number and relation number or employee
number and personnel number. If prompted to upgrade to a new model view, accept. 

4. Select the ribbon Home > group Relationships group > Manage relationships. The
window Manage Relationships opens. Click on New. Select Country at the top of the
table and Paprika at the bottom of the table (automatically with two tables), see figure
12. Select the columns to be linked (Country code in table Country and Code country in
table Paprika ‒ the columns are shown in grayscale), see figure 12. Click OK. The
relationship management window is displayed again. Close this window.                    
Figure 12

5.The one-to-many relationship between both tables is shown (many is indicated in


Power BI with a *), see figure 13. Always check whether the relationship has been
established properly by selecting the relationship. The fields that are linked are then
marked, see figure 13.

Figure 13
6.In the Data pane, view the data of both tables. Note that the Country table
contains more countries than the Paprika table . So not all countries from
table Country are exported.       

7.Select the Report panel and place the Matrix visual . In Rows,


place the Country field from the Country table . All countries from the Country table are
shown. It is not exported to these countries.            

8.Drag the Number of Tons field from the table Paprika to Values . Now the total


number of tons of Paprika that are exported per country is shown. Note that due to the
relationship between the tables, only countries to which there is export are now
shown. The countries to which there is no export are not shown by default.          

9.Drag the Color field from Paprika table to Columns .      

10.Make sure that the column headings, row headings and values are shown in font
size 12pt: Format > Grid.    

Visual 2.2:

1.Place a visual Filled map to the right of the matrix . In a filled map you can show the
data geographically, such as countries/regions, states/provinces or postal codes on a
digital map. Internet is used.   

2. From the Country table, drag the Country Code field to Location of the visual. All


countries are immediately shown on a digital map.      

3.Drag the Code country field from the Paprika table to Legend . Now only countries are


shown (in colors) to which is exported, see figure 14.      

Figure 14
4.Turn off the legend and title in the layout of the visual, they are of no use.

5.Select Germany in the matrix visual. Germany is directly zoomed in on the map. Make


a multiple selection of countries (hold down the Ctrl key).

Visual 2.3:

1.Place another visual Map to the right of the Filled Map visual . Create additional space


if needed by collapsing the Filters panel .

2. Drag the Country field to Location and the Number of tons field to Size . The size of


the number of tons is shown as a bubble in the country map, see figure 15.        

Figure 15

3. Turn off the title and make the Bubbles larger, set in the value 10.   

4.The color of the 'bubble' can also be adjusted by Data Colors. Optionally, you can give
each country a different color in the group Data Colors > Show all > Off.        

5. Now select Germany in the matrix. The country map now also zooms in on the town
in Germany where the 'bell' is placed. That is completely useless. We're going to adjust
that. Choose Format > Map controls >.Auto Zoom > Off. Select Germany again in the
matrix and view the result. Show all countries again.        

6.The report is finished; save it under the name paprika export. 


2.3Visuals with calculated columns and measurements

Before you start creating a report, you should have thought about what that report should
look like and what kind of data you need to do that. The data in the data warehouse must
be enriched with additional data to be able to show certain overviews or graphs. This can
be done with calculated columns or with calculated measurements. A calculated
measurement is called a measure in Power BI . A calculated column calculates a new
value in an added column for each row in the table. The calculated value is immediately
displayed and stored in the new column. Measurements are widely used within BI. It is a
passive calculation that returns a value. This means that the measurement starts
calculating if there is (filter) context; if you use the measurement in a visual. This
provides a performance improvement and does not cost any physical memory space. A
measure is therefore NOT calculated row by row, as with a calculated column. A
measure is only calculated in a visual and works on the active filters (filter context). This
will be made clear with examples. 

Example 3

We are going to enrich the report in Power BI from the previous section with three
additional visuals with calculated columns.

Visual 3.1:

1.Open the Power BI file  paprika export.pbix.   

2.Select the Data pane and select Paprika table . We also want to know the number of


tons of paprika's per 1000 inhabitants of a country. This requires a calculation. We create
a new column in which the calculation will be placed. This is called a calculated
column .     

3.In the ribbon, select Home > group Calculations > New column.     

4. By default, the program chooses the name Column for the column name. Delete that
text and replace it with the calculation you want:  

Tons per 1000 people = [Number of tons.] / ( RELATED(Country[Population] ) / 1000 )

5.If you enter the [ sign, all fields from the current Paprika table will be displayed, so the
field can be entered quickly by selecting it and then using the Enter or Tab key. Since
the Population field is in another table (Country), the RELATED() function must be
used. All related fields are also shown after the RELATED() function . The new column
is also shown in the fields of the table. The new field has a column icon so you can see
that it is a calculated column.          

Remark:

• The tables in Power BI coupled through BI-term  expanded tables. For the two tables in
the data model, the Paprika table is extended with the rows of the Country table . This
expansion takes place from the many-side to the one-side of the relationship between the
tables.

It can be seen as one table, but they remain separate tables. If you want to apply one
metric from the same row from another table, you need to use
the RELATED() function . In the example, the formula: Tons per 1000 people =
[Number of tons.] / ( RELATED(Country[Population] ) /1000 ) has
been applied. Table Paprika is the active table, so [Number of tons.] can be used directly,
but the corresponding entry [Population] from the same row comes from a related table
and for that you have to use RELATED(Country[Population]) .            

•The calculation is performed on the entire column, so all rows from


the Paprika table are run through one by one. This is called iterating . In the calculation,
two column names are shared on top of each other. For each row in the table, the values
of those two columns are now divided, including the division by 1000 to show the result
per 1000 inhabitants. The calculated value is placed in the new column based on the
values in the row. This is called row context within BI ; you perform the calculation on
the underlying table.    

•The formula language of Power BI is different from the formula language you may
know from Excel. In Power BI, the formula language is called DAX (Data Analysis
eXpressions). The basic functions from Excel also exist in DAX, but there are also many
other functions, such as RELATED(). DAX functions can work on the entire table and
therefore do not always return just one value, as in Excel.   

•In the column Tons per 1000 inhabitants are numbers, no formulas as in Excel! It is


called a calculated column as the column is being calculated. If values in the table
change, the calculation is performed again. But it is a physical column of values and not
a 'virtual' column. Suppose you create a calculated column containing the DAX
function: =TODAY(). Each time the file is opened, all rows of the table are iterated and
the current date is entered in the column for each row. This will fill the entire column
with the date of that day.   

6.Select the newly created calculated column in the field list and in the
ribbon , choose Column Tools > Formatting group > two decimal places. Tip: Check
after making a calculated column in this way, always the correct data type: Data type
> Format and the number of decimal places of the new column.      

7.We create another new column to determine the number of tons of paprika's per 10
km2 of land area: 

Tons per 10km2 = [Number of tons.] / ( RELATED( Country[Km2] ) / 10 )

8.Make sure the new calculated column is shown with two decimal places.
9.Select the Report panel and create a Table visual below the matrix visual . Place
the Country field and the two new columns here. The long field names make the
columns showing wide, but they can be made narrower.      

10.We want to sort the table by Tons per 1000 inhabitants. When you click on a visual,
three small icons appear (top right or bottom left of the visual). An icon with filter
information, a Focus mode icon to magnify the visual and a three-dot icon for More
options.     

Figure 16

11.Select More options icon . Select Sort by for Ton per 1000 inhabitants and


choose Sort descending. You can also click on the visual's column headers to sort
quickly.        

12.Remove the totals in the table via the panel Format of the visual. 

Visual 3.2:

1.Add a new visual, Stacked column chart, right to the table.  

2.Drag Country to Axis, Number of Tons to Values (Values) and Color to Legend.

3.The colors ask to be adjusted (green, yellow, red). Match the colors. Brighter or deeper
colors can be shown via Custom color . Optionally, even a specific hexadecimal code
can be entered.     

4.The legend can be turned off and the title of the visual can be centered.

5.Select the stacked column chart, and then click Clustered column chart or Clustered
bar chart. View the result. Turn the visual back into a Stacked Column Chart.      

Visual 3.3:

1. We make a final visual Stacked column chart. Drag color to Axis and Number of


tons to Values .          

2.Make sure that the columns are shown in the colors red, green and yellow. Tip: Select
the previously created stacked column chart and choose in the ribbon Home > group
Clipboard > Format Painter. Then click in the new chart.    

3.The report is complete. Save it under the name  paprika export. 

Example 4
Jeweler LeMair has stores in the Netherlands, Belgium and Germany. In addition, there
is an internet site where orders can be placed. In addition to the three countries
mentioned, France is also served via the website. Customers can make a purchase
anonymously in the stores or use a loyalty card.

Five visuals are created for this report.

Visual 4.1:

1.Open the Power BI file  LeMair.pbix (double click on file). The data has already been
adjusted and loaded, you will immediately enter the Power BI environment.  

2.View the contents of the four tables in the Data pane . See the number of rows of the
tables. The Sales table has nearly three million rows!    

3.View the relationship diagram in the Model pane , see figure 17. This clearly shows
the star schema, with the Sales fact table (only has many-to-one relationships) and
the Branch, Customer and Item dimension tables . The relationships between the tables
have already been established. Select a relation; the linked fields are displayed.       

Figure 17

4.We want to determine the sales numbers in various visuals. In the Data pane,


select Sales table . In the ribbon Home > group Calculations > New measure. Remove
the default name and change it to: Sales = SUM( Sales[Amount] )

Remark:
•The calculation of a measure should always contain a DAX function that aggregates
(summarizes)! Common DAX functions for a measure
are: SUM(), AVERAGE(), MIN(), MAX(), COUNT(), COUNTROWS(), and DISTINC
TCOUNT(). The last function counts the number of unique values in a column.        

•No new column is created after entering the formula. Nothing changes in the table. A
measurement is not calculated in a row of a table, which is why a measurement is NOT
shown as a column in the table. The measurement is only calculated in a visual based on
active filters.

•The measure has been added as a field in the Sales table . There is an icon of a


calculator in front of it so that you can see that it is a measurement.  

•For measurements, the full field name must always be entered, so Sales[Amount] and
not just [Amount].  

• By selecting the measurement, the format can be adapted: Measure tools > group
Formatting, for example, display in Euro.  

5. Select the panel report and place the visual Card With such a visual you can, for
example, show a prefix. Place the measurement Offset in the map (5M). Make sure the
exact outcome (4,732,828) is shown through pane layout (size) of the visual in the
group Data label > Display units > None).            

6.The new Sales measure works on filters, so it doesn't always show


4,932,477. 4,932,477 is now shown because no filter is active. This cycles through all
the rows of the Sales table and adds up the sales quantity (SUM). Change the map visual
in the visual Clustered Column Chart by clicking on the map in the visual canvas and
then clicking on the desired visual. One column is shown with a height of 5M. Select
panel Fields (Fields) of the visual field and now trail the Category Table Item to
select Axis (Axis) of the column chart. The total sales per category are now
shown. The Sales measurement was performed for all categories . A filter is active for
each category (14 in total) and the measurement is performed per filter (add sales
numbers).                

7. Finally, we show the sales in the columns. Select Format and turn Data Labels


to On.      

Visual 4.2:

1.Place a new visual Matrix to the right of the column chart . Drag the


field StoreNumber from Table Stores to Rows of the matrix. Drag the Gender field from
Table Article to Columns of the matrix. Drag the Sales measure to Values from the
matrix.                 

In visual 4.1 the measure Sales is calculated on the Category filter , in this visual on the


Filters StoreNumber and Gender of the jewel. For example, Store 101 sold a total of
11,009 pieces of women's jewelry. For each value in the matrix (including the totals) a
filter is active and the measurement Sales is determined on this. So a measure is
performed on the filters (filter context) of the visual.          

2.We only see store numbers in the matrix, not the store name. If you want to see store
number and store name, a calculated column must be added. Select the Data pane and
select Store table .   

3.Create a new calculated column in the Stores table: Store = Stores[StoreNumber] & " –
" & Stores[StoreName]

4.We are going to use the new calculated column in the matrix visual. Select the maxtrix
visual, remove StoreNumber from Rows and place the calculated
column Store in Rows. Now the full name (store number and name) is shown in the
matrix. Note: Internet sales are booked at store number 999.        

Visual 2.4.3:

1. We are going to create a calculated column. In the Data pane, select Sales table . The


unitprice per piece and the discount per piece determine the selling price per piece. Since
this applies to all rows, a new column is created for the sales price per piece. Create a
new calculated column: Sales Price = [UnitPrice] – [Discount].    

2.Select the Sales Price column and use Column tools > Formatting group, to set the
number of decimal places after the decimal point to 2 ().      

3.Since we want to determine the revenue on different filters, for example per store, per
country or per year, a measure is necessary for the revenue. The line-level revenue
is [Amount] * [UnitPrice]. But a measure must always have an aggregated (summarized)
function, so that it can be determined over the active filters (filter context). So you would
expect SUM( [Amount] * [UnitPrice] ). However, within the DAX function SUM()
there can only be one column, SUM(<Column>), and no calculation (expression). DAX
has another function for this: SUMX(<table>,<expression>). That function has two
arguments. The first is a table and the second is the expression (calculation). Select
table Sales and create the measurement:        

Revenue = SUMX( Sales, Sales[Amount] * Sales[UnitPrice] )  

The first argument indicates that the calculation is made in the Sales table , and then the
calculation (expression) follows in the second argument. The Revenue measure has been
added to the fields of the Sales table .     

4.Select the Report panel . Create the new visual in a new tab. Click the + sign next to
the Page 1 tab .    
5.Insert visual  Stacked column chart in the new canvas. Drag the field Country
code from the table Customer to the option Axis of the column diagram, and the
measure Revenue to Values. The data labels in the visual are turned on.            

The Revenue measure is now determined per customer country code. The revenue of


customers who buy anonymously falls under Anonymous. Each column has its own
filter and the turnover is determined on this.   

Visual 4.4:

1.Create a visual Matrix to the right of the column chart . Drag the Country


Code field from table Stores to the rows of the matrix. From the Sales table,
drag the OrderDate field to the columns of the matrix. Then place
the Revenue measure in the Values option of the matrix. The turnover is now shown per
country code of the branches and per year. The total internet turnover is also shown
(branch number 999).             

2.A date field (Order Date) has a hierarchy (year, quarter, month and day) by
default. This can be seen in the Columns option of the matrix. If a field with a hierarchy
is applied in a visual, additional buttons become available. Those extra buttons can be
above or below the visual. The highest hierarchy, Years, is shown by default.   

3.The next level in the hierarchy, Quarters, is selectable via a button with the twin
arrows. Show the next level of the order date (Quarters). Note that, for example, all years
for quarter 1 are together. This probably makes little sense, but it can be solved. 

4.Show the turnover per year again via the button with the single up arrow. Then click
on the button with the symbol where the arrows split. Now the quarters per year are
shown. Clicking the same button again expands one level down; per year per quarter the
months become visible. The overview scrolls to the year 2022. Note that many measures
(Turnover) have been performed in this overview. A measure works on the filter and
always produces one value per filter. For example, filter Country Code = 'BE' and Order
Date in January 2022 yields one value, €664,697.04. As soon as a measure is applied in
a visual, the underlying table is cycled through. Iterating through the table is called an
iteration .   

5.Make sure that the year, quarter and month are visible in the matrix visual. Finally, we
are going to add slicers. A slicer is an alternative way to filter. Place a
visual Slicer below the column chart.  

6.Drag the Gender field from the Article table into the slicer. Immediately all (four)


options from the Gender field become available in the slicer, and can be selected. The
selection is filtered on the underlying table and therefore automatically also on the
visuals. A multiple selection can be made by holding down the Ctrl key. Note, if no
option is selected in the slicer, there will be no filtering.      
7.De slicer does not default the option Select All . Select the slicervisual and choose the
panel Format > Selection controls. Set the Show 'Select all' option to On .          

8.Place a new slicer to the right of the slicer you just created.

9.In the field list, the OrderDate field in the Sales table has an expansion symbol, a V
sign, in front of the field name. Click on this; this makes the Date Hierarchy visible. The
date hierarchy can also be expanded. This shows the hierarchy of a date field

10.Drag the Year field from the date hierarchy from OrderDate to the slicer visual.    

11.In a slicer with a numeric value, two fields are shown by default, with a lowest and a
highest value. The intermediate value, including boundaries, is filtered on. But the slicer
type can be changed. At the top right of the slicer you can select a slicer type at the V
sign. Default type is Between for numeric values. Research the different slicer
types. Now select the slicertype List and make sure the option Select All appears.      

12.Place two more slicers, with which you can filter by quarter and month.

13.We can further perfect the slicers. Select only the year 2022 in the year slicer. In the
slicer with quarters, you can now choose from four quarters. But the revenue data runs in
2022 through August, so there's no fourth quarter. We can make sure the fourth quarter
doesn't become available.

14.Select the quarter slicer. Then drag from the field list of measure Revenue to the
panel filters, filters to this visual, data fields add,

15.Choose for the condition within that filter: is not blank, and click on Apply filter. The
fourth quarter disappears from the slicer, because in the fourth quarter there is empty for
the year 2022.    

16. The same goes for the slicer with the months. For the year 2022, only the months of
January to August have revenue. Make sure that the month slicer only shows the options
that have revenue, see steps 14 and 15. The Filters panel can then be collapsed again.  

Visual 4.5:

1.The last visual creates a line chart . Select the Report panel and create a new report. 

2. Place the new visual tab Line chart and make the field of visual larger so it is easier to
read. From the date hierarchy of the Order date, just drag the Month field to the Axis
and Revenue to Values of the visual.            

3.Add a slicer visual in the report and drag the Year and Quarter fields from the date
hierarchy into the slicer. Year above Quarter and slicer type List. Make the size of the
slicer appropriate.          
You can place multiple fields from the same table in a slicer to create a hierarchy within
the slicer.

4.Turn pane size of the slicer in group  controls Selection by selecting the All
option to On (Show "Select All" option, On).        

5.In the same panel, the display of the hierarchy can be modified within the Group Items
option Expand / collapse icon. Choose the icon for Plus/Minus as the display.     

6. Place another slicer to the right of the slicer containing the


fields Category and Gender from table Article (Category above Gender). Make the
structure of both slicers same, so the option Select All actively creating and displaying
the hierarchy via a plus / minus icon.            

7.In the slicers, select year 2021 (all quarters) and only ladies bracelets.

8.Select the line chart visual and change some properties in the Format pane :  

-Change under Data colors the color of the turnover in bright red (selectable via Custom
color ).    

-Put under Shapes the width Stroke to the value 3 and  Show marker to On.          

-Change under Title the  text Title in turnover Lemair and make the Font


color black. Select at Alignment for centering and change the text size so that the title is
legible.            

9.Right to the rolling brush is a third switch Analytics. Select that button. With a line
chart, all kinds of analytical lines can be displayed in the visual.   

10. Click on Add in line for average.    

11.Exit Power BI.

You might also like