You are on page 1of 8

01 - Ugly Model – Demo and then show how to fix

01 - Ugly Model – Start.pbix

 Violation of all our rules


 Not focused for the user -> User wants to understand Internet Sales
 Too many tables -> Some are not needed
o Remove
o Collapse
 Too many columns (remove)
o Spanish
o English
 Hide
o Key Columns
o Any tables
 Summarizations
o Dim Customer -> Geography Key
o Affects the visualizations
 Data Types
o Are good in this model because the borrow from a data warehouse
o But what if it did not?
 Column formatting
o Show a few
 Data Categorization
o Dim Sales Territory
 Renaming and Synonyms
 Sort by Columns
 Hierarchies
 Date Table
o Declare a date table
02 – REMOVE what is not needed

02 - Remove what is not needed.pbix

o Part 1
o Other countries sales
o United States Sales
o Sales Touring Promotion
o Part 2
o Product SID in Product Table (not used for anything, therefore remove)
o Part 3
o Product and Product Levels combine

03 – Hide

03 - Hide what is not needed – Start.pbix

o Part 1
o Tables
o Dim Product Category
o Dim Product Subcategory
o Part 2
o Primary Key Column (needed to glue the model together but not for reporting)
o Remove versus Hide

04 – Friendly Names and Synonyms

04 - Friendly Names – Start.pbix

o Table Names
o Rename a few
o At Data Model level but really should be done back in Power Query
o Column Names
o Rename a few
o Show how you can change in the visualization
o Synonyms and QA
05 – Data Types, Column Formatting, Data Categorization, Default
Summarization, Sort by Columns

05 - Data Types Formatting Categorization etc.pbix

Task 3: Change Data Summarization Method

It is a good idea in your data models to review if any of columns have been set with default
summarizations and if so, have they been set properly. We will review the model in class for this
behavior.

For more information, please refer to Microsoft tutorial page:


https://docs.microsoft.com/en-us/power-bi/service-aggregates

 Order Quantity
 Sales Amount

Task 4: Add Data Categorization

1. In the Data view, select the Sales Territories table.


2. Select the Country column.
3. From the ribbon, navigate to Modeling > Properties > Data Category. From the drop-
down menu, choose Country/Region.
4. Set the Data Category for the column Continent to Continent.
5. Upon completion, the columns Country and Continent in the Sales Territories table
will have a globe icon next to them.

Figure 1 Sales Territories with Data Categorization


Task 5: Change Data Format of Columns

1. In the Data view, navigate to Field pane, and select Sales table.
2. Select the column UnitPrice. From the ribbon, navigate to Modeling > Formatting >
Format. Select Currency > $ English (Unites States).
3. Make sure that the currency format has 2 decimal places, the setting lives under the
same Formatting tab as shown in Figure 2.

Figure 2 Setting for decimal places

4. The data in the column will now have dollar sign (Figure 3).

Figure 3 Data in Currency Format

5. Change the data format to Currency for the following columns too: SalesAmount and
Sales Amount with Tax.

Task 6: Create Hierarchy

In this task, two hierarchies will be created to allow drill down of data in the reports: Order Date
Hierarchy and Product Hierarchy.

1. Remain in Data view (Power BI Desktop).


2. In the Field pane, select Order Date table.
3. Rename the following fields by right-clicking on the fields in the Fields Pane
a. CalendarYear to OrderDateCalendarYear
b. MonthName to OrderDateMonthName
4. Right-click on OrderDateCalendarYear and select New hierarchy.
5. Rename the newly created OrderDateCalendarYear Hierarchy to
OrderDateHierarchy.
6. To add OrderDateMonthName to the hierarchy, right-click OrderDateMonthName,
navigate to Add to Hierarchy, and select OrderDateCalendarYear
7. To add OrderDate to the hierarchy, right-click OrderDate navigate to Add to Hierarchy,
and select OrderDateCalendarYear. The Result should look like (Figure 4).

Figure 4 OrderDateHierarchy

8. Hide the following fields in the Order Date table from Report view by right-clicking the
fields and selecting Hide in Report View from the context menu. Choose the fields that
are not in the hierarchy.
 OrderDateCalendarYear
 OrderDateMonthName
 OrderDate
9. Now let’s build the Product Hierarchy. In the Field pane, select Product table.
10. Rename the following fields:
a. ProductCategory to Product Category
b. ProductSubcategory to Product Subcategory.
c. ProductName to Product Name
11. Right-click on Product Category and select New hierarchy.
12. Rename the newly created Product Category Hierarchy to Product Hierarchy.
13. Right-click Product Subcategory navigate to Add to Hierarchy and select Product
Hierarchy.
14. Right-click Product Name navigate to Add to Hierarchy and select Product Hierarchy.
15. Your Hierarchy should look like Figure 33
Figure 5 Product Hierarchy

16. Hide the following fields in Product table from Report view by right-clicking the fields and
selecting Hide in Report View from the context menu. Choose the fields that are not in
the hierarchy.
 Product Category
 Product Subcategory
 Product Name
17. Save and Close your Demo.pbix file

Sort by Column

 Calendar Year Slicer


o 2011
 Line Graph
o Month Name
o Sales Amount with Tax

Task 11: Create a Calculated Column to combine Month and Year


Column

1. Ensure that you have the Demo.pbix open per the above instructions.
2. In the Fields pane, right-click on Order Date table, select New column.
3. In the formula bar, delete the default values and enter the following DAX formula, when
finish, press enter:
Month-Year = 'Order Date'[OrderDateMonthName] & "-" & 'Order
Date'[OrderDateCalendarYear]
4. The new calculated column, Month-Year, can be found in the Order Date table.
Figure 6 Calculated Column in Order Date Table

Figure 7 Example of Month-Year Column

Task 12: Create Measures for Total Sales Amount and Last Year Sales
Amount

1. In Power BI Desktop, open the Data View. In the Fields pane, right-click on Sales table,
select New Measure.
2. In the formula bar, which is located above the Data preview, delete text Measure = and type
in the following DAX formula, then press the enter key:
Total Sales = SUM('Sales'[SalesAmount])
3. Change the format of the measure by navigating to the ribbon. Select Modeling >
Formatting > Format: General > Currency > Currency General.
4. Create a second measure to calculate last year sales amount using the following DAX
formula, then press the enter key:
Total Sales Last Year = CALCULATE([Total Sales], SAMEPERIODLASTYEAR('Order
Date'[OrderDate]))
5. Repeat step 3 to change the format of the measure.
6. You can find the new measures, Total Sales and Total Sales Last Year in the Sales table,
denoted by a calculator icon Figure 8.

Figure 8 Measures in the Sales Table

You might also like