PowerBIPRIAD Lab05A
PowerBIPRIAD Lab05A
PowerBIPRIAD Lab05A
Paginated Reports
in a Day
Lab 05A - December 2022 release
In this lab, you will develop a report named Sales Performance. It will include a Table based on a Power
BI dataset that presents salespeople statistics grouped by country.
Important: There are many repetitive tasks when developing reports. The labs in this course will
progressively reduce the detailed step-by-step instructions when detailed steps have already been
provided.
Important: If you didn’t successfully complete Lab 02B, you can open the report template found in the
<CourseFolder>\PowerBIPRIAD\Lab02B\Solution folder.
1. In the Report Data pane, right-click the Data Sources folder, and then select
Add Power BI Dataset Connection.
2. In the Select a Dataset From the Power BI Service window, at the left, select the workspace you
created in Lab 01A.
If you don’t see the Sales Analysis dataset, it could be because you didn’t upload the Power BI
Desktop file in Lab 01A. In this case, return to Lab 01A, and complete the steps to upload the Power BI
Desktop file.
4. Click Select.
5. In the Report Data pane, notice the addition of the data source.
1. In the Report Data pane, right-click the data source, and then and then select Add Dataset.
2. In the Dataset Properties window, in the Name box, replace the text with dsMain.
5. In the Query Designer window, on the toolbar, notice that the query designer is set to DAX.
6. In the Metadata pane (located at the left), expand the Salesperson table.
8. To add a level to the query, drag the Country level, and drop it into the query pane (the large pane,
located at the right).
10. In the Metadata pane, expand Measures (located at the top), and then expand the Sales measure
group.
• Target
• Variance %
13. In the Target measure group, expand the _KPI folder, and then drag-drop the
Sales Performance Status measure to the query pane.
14. In the query pane, verify that there are six columns headers:
• Country
• Salesperson
• Sales
• Target
• Variance %
15. To apply a filter, in the Metadata pane, expand the Date dimension.
16. Drag-drop the Fiscal Year attribute into the filter pane (located above the query pane).
17. In the Filter pane, click inside the Filter Expression column.
20. To the right of the filter expression, check the Parameters checkbox (you may need to scroll
horizontally to reveal the checkbox).
21. In the middle of the query pane, click the link to execute the query.
22. Review the query result, noticing the values in the Sales Performance Status column.
The values are 1, 0, or -1. 1 means “on track”, 0 means “slightly off track”, and -1 means “off track”. You
will visualize these values as indicators in Lab 05B.
24. In the Dataset Properties window, in the Query box, review the DAX query statement, noticing the
@DateFiscalYear query parameter.
The Analysis Services designer will create a hidden dataset to provide available values to the report
parameter.
• Sales_Performance_Status: Status
Some characters used in the model object names are invalid in report designs, and therefore they can’t
be used as report object identifiers. Invalid characters are converted to the underscore (_) character.
As a report author you can rename field names to make them more concise and easier to understand.
It’s a good practice to rename fields before they are used in report expressions.
3. Click OK.
VB.NET
=Trim(Parameters!DateFiscalYear.Label)
This expression trims any leading or trailing white space from the parameter label Trimming is
necessary because the available values for years include proceeding spaces, which achieve
indentation.
1. To add a Table, right-click inside the report body, and then select Insert | Table.
2. Notice that the Table template consists of three columns, and two rows: the header and a detail row.
Each cell of the Table is in fact a text box. Yet, they work together as a template. At render time, data
retrieved by the dataset is used to inflate the template into a grid layout.
To clearly communicate lab step instructions, at times a text box location may be expressed by using
Excel-like column and row coordinates within square brackets. The first column is column A. The first
row is row 1. The first text box in the first row is therefore [A1]. Ranges of text boxes may be similarly
expressed by using Excel notation within square brackets. For example, the range of all three text
boxes in the first row is [A1:A3].
• Location, left: 0
• Location, top: 0
5. To reveal the Field List, the cursor in the top right corner of the first detail text box [A2].
This step configures the Table to use the dsMain dataset and updates the text box [A1] Value
property with an expression to display the value property of the selected field. It also places the field
name into the text box [A1] in the table header
7. Repeat the last step to add the Sales and Target fields to the next two columns.
The Field List selection no longer requires the selection of a data source or dataset. A data region can
only be bound to a single dataset. The first field selection set the associated dataset.
8. To add a new column, right-click the column guide (located above the Table header text box) for
the Sales column, and then select Insert Column | Right.
The column and row guides are only available when the Table is in focus. If the Table isn’t in focus,
simply select any text box within the Table.
9. In the detail text box of the new column [D2], select the Variance_Pct field.
10. To format the table header, and to select all text boxes in the table header, select the table header
row guide.
12. Select any table header text box, and then set the height to 0.35.
13. Select all detail row text boxes, and then set the vertical alignment to Middle.
14. Select any detail row text box, and then set the height to 0.35.
15. To resize the width of the first column, select any text box in the first column, and then set the width
to 1.7.
It’s also possible to resize row and column sizes by dragging the guide edges. However, this technique
won’t allow a precise size adjustment.
16. To multi-select the Sales and Target column guides, first select the Sales column guide, and then
drag to select the Target column guide.
The N format code formats numeric values as numbers with a thousand separator; N0 displays zero
decimal places. C can be used for currency formats, and P for percentage, and each also can be
followed by a number indicating the number of decimal places.
Tip: The Text Box Properties window includes a Number page that can be used to apply many
different formatting options.
18. Select the Variance_Pct column guide, and apply the following formats:
19. In the Variance_Pct column header text box [D1], modify the value to Variance %.
21. To configure conditional formatting, right-click the Variance_Pct detail row text box [D2], and then
select Text Box Properties.
22. In the Text Box Properties window, select the Font page.
VB.NET
=Iif(Fields!Variance_Pct.Value < 0, "Red", "Black")
This expression tests the value of the Variance_Pct field. When it’s less than zero the value “Red” is
returned, otherwise “Black” is returned.
27. Preview the report, and then review the report and notice that negative Variance % values are red.
Conveying status with color may not work for some people with vision impairment. In Lab 05B you
will enhance the table with indicators that can convey status using both shape and color.
4. Notice that a table footer row has been added, and that the last three text boxes [B3:D3] each
include an expression to sum the field values.
Numeric fields added to non-detail row text boxes usually should be aggregated to summarize the
values contained in numerous detail rows.
5. In the first text box of the footer row [A3], enter the value Total.
6. Select the footer row guide, and then apply the same alignment, background color, font weight, and
height used in the table header:
• Height: 0.35—sometimes setting the height for multiple text boxes is not possible, in which case
select a single text box, and then set its height
7. Verify that that the Table layout looks like the following:
9. In the table footer, notice that the Variance % total of 411.51% represents the sum of the individual
salespeople’s variances values.
This summary variance percent value is incorrect. Summing ratios to produce a total ratio does not
produce a meaningful result.
VB.NET
=Sum(Fields!Sales.Value - Fields!Target.Value) / Sum(Fields!Target.Value)
12. Preview the report, and then review the table total values that are now correct.
2. In the Group pane (located beneath the report canvas), inside the Row Groups, right-click the
(Details) group, and the select Add Group | Parent Group.
4. Click OK.
6. To remove the new column, right-click the column guide for the new column, and then select
Delete Columns.
8. Use the Field List to add the Country field to the first group header text box [A2].
9. Multi-select the three table footer numeric text boxes [B4:D4], then right-click the selection, and
then select Copy.
10. Inside the Country group header row, right-click the Sales text box [B2], and then select Paste.
The aggregate expressions used in the table footer work when aggregating at the country level.
11. Select the Country group header row guide, and then set the following properties:
• Height: 0.35
12. To indent the detail rows, select the Salesperson text box [A3], and then set the
Alignment | Padding | Left property to 12pt.
13. To sort the salespeople by descending sales value within their country, in the Grouping pane
(located beneath the report canvas), right-click the (Details) group, and then select
Group Properties.
• Order: Z to A
18. Preview the report, and then notice that the United States salespeople are ordered by descending
sales.
3. Select the column guide of the new column, and then on the toolbar, set the font size to 8pt.
4. Set the width of the new column to 0.7–you may need to select a single text box, and then set the
width.
6. In the table header text box of the new column [C1], enter Country %.
VB.NET
=Fields!Sales.Value / Sum(Fields!Sales.Value, "Country")
This expression divides sales by the sum of the sales at the Country group level.
8. Preview the report, and then notice that the new calculation produces the ratio of a salesperson’s
sales over their country’s sales.
11. In the detail text box [D3], enter the following expression:
VB.NET
=Fields!Sales.Value / Sum(Fields!Sales.Value, "dsMain")
This expression divides sales by the sum of the sales at the dataset level.
12. In the Country group header text box of the new column [D2], enter the following expression.
VB.NET
=Sum(Fields!Sales.Value) / Sum(Fields!Sales.Value, "dsMain")
This expression divides the sum of sales at Country group level by the sum of the sales at the dataset
level. There’s no need to specify a scope in the first sum function as the expression is evaluated at the
Country group level.
14. Remove any excess body height (trailing white space beneath the table).
16. Preview the report, and then notice that the new calculation produces the ratio of a salesperson or
country’s sales over total sales.
17. On the Run ribbon tab, from inside the Print group, click Print Layout.
18. Navigate to the second page, and then notice that the table header did not repeat on the second
page.
2. Located at the far right of the Grouping pane, click the down arrow, and then select
Advanced Mode.
5. To turn off advanced mode, at the far right of the Grouping pane, click the down arrow, and then
select Advanced Mode again.
In the next lab, you will continue the development of the Sales Performance report by adding data
visualizations.
COPYING OR REPRODUCTION OF THE HANDS-ON LAB (OR ANY PORTION OF IT) TO ANY OTHER
SERVER OR LOCATION FOR FURTHER REPRODUCTION OR REDISTRIBUTION WITHOUT WRITTEN
PERMISSION IS EXPRESSLY PROHIBITED.
FEEDBACK If you give feedback about the technology features, functionality and/or concepts described
in this hands-on lab to Microsoft, you give to Microsoft, without charge, the right to use, share and
commercialize your feedback in any way and for any purpose. You also give to third parties, without
charge, any patent rights needed for their products, technologies and services to use or interface with
any specific parts of a Microsoft software or service that includes the feedback. You will not give
feedback that is subject to a license that requires Microsoft to license its software or documentation to
third parties because we include your feedback in them. These rights survive this agreement.
MICROSOFT CORPORATION HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS WITH REGARD
TO THE HANDS-ON LAB, INCLUDING ALL WARRANTIES AND CONDITIONS OF MERCHANTABILITY,
WHETHER EXPRESS, IMPLIED OR STATUTORY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-
INFRINGEMENT. MICROSOFT DOES NOT MAKE ANY ASSURANCES OR REPRESENTATIONS WITH
REGARD TO THE ACCURACY OF THE RESULTS, OUTPUT THAT DERIVES FROM USE OF THE VIRTUAL LAB,
OR SUITABILITY OF THE INFORMATION CONTAINED IN THE VIRTUAL LAB FOR ANY PURPOSE.
DISCLAIMER This lab contains only a portion of new features and enhancements in Microsoft Power BI.
Some of the features might change in future releases of the product.