官术网_书友最值得收藏!

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:

  1. Go to Diagram View, maximize the Date table (with a maximize icon in the top right-hand side of the Date table).
  2. Create a hierarchy (the second icon from the top right-hand side of the date table shown in the next screenshot), name the hierarchy as Calendar, and drag-and-drop CalendarYear, CalendarQuarter, EnglishMonthName, and FullDateAlternateKey as levels of this hierarchy.
    Time for action – creating a hierarchy from a single table
  3. 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.
  4. 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.
  5. 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.
  6. 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).

主站蜘蛛池模板: 乌审旗| 汽车| 卢龙县| 聊城市| 光山县| 共和县| 佛学| 龙南县| 杭锦后旗| 汉寿县| 河东区| 屏山县| 黄梅县| 荥阳市| 芦溪县| 彰化市| 盱眙县| 天津市| 双牌县| 广灵县| 连云港市| 吕梁市| 佛冈县| 循化| 铜山县| 孟村| 宾川县| 阿勒泰市| 吉林省| 长武县| 扶沟县| 大田县| 深水埗区| 玉山县| 平南县| 漠河县| 湖北省| 吉隆县| 达尔| 成安县| 理塘县|