- Microsoft SQL Server 2014 Business Intelligence Development Beginner’s Guide
- Reza Rad
- 424字
- 2021-08-13 17:55:27
Time for action – creating measures
Tabular doesn't have any measures by default; this means that you need to add measures as required, but don't worry as creating measures is very easy in the model designer. In this example, you will see how to create measures such as Order Quantity or Sales Amount.
- Under the Model menu, select Analyze in Excel; in the dialog box, choose the current Windows user.
- You will see an Excel spreadsheet open, and in a PivotTable, all the tables from the current tabular model are listed. In the PivotTable fields list under Internet Sales, choose Sales Amount.
- You will see distinct values of the Sales Amount measure shown instead of a measure with the summary of all the sales amount. This is because there is no measure for the sum of the sales amount, and by default, all the values (even numeric ones) are shown as distinct values.
- In SSDT, go to the Grid View of the Internet Sales table. Click on an empty measure cell under the Sales Amount column, and then click on the sum icon (this will create DAX in the background, which will be covered later in this chapter). Do the same for Order Quantity (look at the following screenshot). Then, select the Sum of OrderQuantity measure, and in the Properties pane, change the format to a whole number and set show thousand separator as true.
- Save the changes and go back to the Excel spreadsheet. Uncheck Sales Amount and click on Refresh the PivotTable. Now, you will see a list of measures at the top of the PivotTable fields list; select Sum of SalesAmount and Sum of OrderQuantity from measures. Select Calendar Year under the date. Now, you will see how measures are shown in the designer sliced and diced by the calendar year.
What just happened?
In this example, you learned how to view the results of the tabular model in Excel with Analyze in the Excel option. This option will open an Excel spreadsheet with PivotTable that enables you to slice and dice data with different tables and shows measures in comparison to each other (described in steps 1, 2, 3, and 5).
You also saw how easy it is to create measures and configure properties such as format string for measures (step 4). Measures created based on expressions (shown in the screenshot after step 4) are written in the DAX language. DAX provides many functions, and you can enhance them to create complex expressions to create measures, as your business requires.
- 少年輕松趣編程:用Scratch創作自己的小游戲
- 三維圖形化C++趣味編程
- 薛定宇教授大講堂(卷Ⅳ):MATLAB最優化計算
- Mastering Python High Performance
- Mastering RStudio:Develop,Communicate,and Collaborate with R
- 青少年Python編程入門
- Elasticsearch Server(Third Edition)
- 可解釋機器學習:模型、方法與實踐
- 從Excel到Python:用Python輕松處理Excel數據(第2版)
- C++面向對象程序設計習題解答與上機指導(第三版)
- SQL Server與JSP動態網站開發
- Java面向對象程序設計
- 執劍而舞:用代碼創作藝術
- Getting Started with Eclipse Juno
- C/C++數據結構與算法速學速用大辭典