- Microsoft SQL Server 2014 Business Intelligence Development Beginner’s Guide
- Reza Rad
- 280字
- 2021-08-13 17:55:28
Time for action – creating a hierarchy from a single table
In this example, we want to create a calendar hierarchy in the Date table. So, this example shows how to create a hierarchy from a single table. A calendar hierarchy will have the year, quarter, month, and date level:
- Go to Diagram View, maximize the Date table (with a maximize icon in the top right-hand side of the Date table).
- Create a hierarchy (the second icon from the top right-hand side of the
date
table shown in the next screenshot), name the hierarchy asCalendar
, and drag-and-drop CalendarYear, CalendarQuarter, EnglishMonthName, and FullDateAlternateKey as levels of this hierarchy. - Save the changes and view the tabular model in Excel. Select Calendar under Date. Also, select Sum of SaleSamount from measures. You will see that the calendar hierarchy shows the hierarchy of years, quarters, months, and dates.
- We observe that the order of month in the calendar is not correct; it is already ordered based on the month name, but it should be ordered based on the month number as well.
- Go to Grid View of the Date table, select the EnglishMonthName column, and then from the tabular toolbox icons on the top, click on the Sort By Column icon. Choose MonthNumberOfYear as the Sort By Column.
- Save the changes and refresh PivotTable; now you will see that the order of the month shows correctly as January, February, and so on.
What just happened?
Creating hierarchies from a single table is as simple as dragging-and-dropping columns (step 1 to 4). Also, in this example, you saw how you can change the sort order of a column based on other columns (step 5).
推薦閱讀
- 在最好的年紀(jì)學(xué)Python:小學(xué)生趣味編程
- 大學(xué)計(jì)算機(jī)基礎(chǔ)實(shí)驗(yàn)教程
- R語(yǔ)言游戲數(shù)據(jù)分析與挖掘
- Raspberry Pi for Secret Agents(Third Edition)
- Android NDK Beginner’s Guide
- Building a Quadcopter with Arduino
- ExtJS高級(jí)程序設(shè)計(jì)
- Unity 2D Game Development Cookbook
- Scala Reactive Programming
- 蘋果的產(chǎn)品設(shè)計(jì)之道:創(chuàng)建優(yōu)秀產(chǎn)品、服務(wù)和用戶體驗(yàn)的七個(gè)原則
- Procedural Content Generation for C++ Game Development
- The Professional ScrumMaster’s Handbook
- 從Power BI到Analysis Services:企業(yè)級(jí)數(shù)據(jù)分析實(shí)戰(zhàn)
- VMware vSphere 5.5 Cookbook
- 歐姆龍PLC編程指令與梯形圖快速入門