Professional Documents
Culture Documents
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
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
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
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.
Order Quantity
Sales Amount
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.
4. The data in the column will now have dollar sign (Figure 3).
5. Change the data format to Currency for the following columns too: SalesAmount and
Sales Amount with Tax.
In this task, two hierarchies will be created to allow drill down of data in the reports: Order Date
Hierarchy and Product Hierarchy.
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
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
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.