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

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

主站蜘蛛池模板: 克拉玛依市| 广河县| 建平县| 静安区| 卢龙县| 东明县| 朔州市| 泗阳县| 翁源县| 久治县| 集贤县| 新密市| 城步| 舒城县| 监利县| 客服| 嘉荫县| 南投市| 衡水市| 元氏县| 改则县| 惠东县| 武穴市| 颍上县| 义乌市| 科技| 峨眉山市| 化州市| 观塘区| 云龙县| 桐柏县| 抚顺县| 阿拉善左旗| 合作市| 太和县| 洛扎县| 兴城市| 高州市| 中西区| 法库县| 涡阳县|