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

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).

主站蜘蛛池模板: 昔阳县| 庄浪县| 和顺县| 美姑县| 无为县| 金坛市| 峡江县| 长沙市| 兴仁县| 海林市| 若尔盖县| 沙坪坝区| 东平县| 望城县| 惠水县| 涿鹿县| 新巴尔虎左旗| 沙坪坝区| 阿克苏市| 哈巴河县| 阜阳市| 醴陵市| 黔南| 本溪| 博湖县| 福清市| 班玛县| 安顺市| 南雄市| 苍山县| 中超| 吉林市| 北辰区| 四子王旗| 抚顺市| 乌拉特前旗| 砚山县| 衡阳县| 阜宁县| 盐津县| 博爱县|