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

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

主站蜘蛛池模板: 东乌| 济宁市| 无棣县| 大荔县| 方正县| 若羌县| 崇仁县| 屏南县| 台北市| 晋中市| 如皋市| 沂水县| 衡水市| 邵武市| 楚雄市| 文山县| 三原县| 关岭| 乌兰察布市| 大竹县| 张北县| 彩票| 阜康市| 麻栗坡县| 铁力市| 台南市| 枝江市| 农安县| 桐梓县| 土默特右旗| 马鞍山市| 洪泽县| 宁陵县| 大厂| 枝江市| 永川市| 满洲里市| 芦山县| 江孜县| 瓮安县| 洛浦县|