各季度销售额的直方图如下所示:
问题:如何展现出销售额的同比变化(如,与上一年度同一季度的进行比较)?
解决方案:单击图标左侧Y轴销售额,编辑公式为“Sum([Sales Total]) - Sum([Sales Total])OVER (ParallelPeriod([Axis.X]))”,即可实现该需求。
以下内容节选自官方文档:
The OVER functions areused to determine how data should be sliced, for example, relative to timeperiods. For more information, see OVER in Custom Expressions and AdvancedCustom Expressions.
Option: Parallel Period
Uses the previousparallel node with the same value on the same level as the current node. Forexample, this can be used to compare sales results for each month with thecorresponding months the previous year.
Example:
Sum([Sales])-Sum([Sales])OVER (ParallelPeriod([Axis.X]))
以下内容为培训资料中的说明:
The ParallelPeriod() method is handy because itperforms a set of common node navigations at once. From your currentnode, the method traverses up one level of the hierarchy, then navigates to oneprevious node at the parent level, and then descends back down the hierarchy tothe original level to find the mode value that matches the starting point.
*Note that the expression does not need to take the colorproperty into consideration with an All() method. This is because coloris slicing by quarter, and ultimately we are constraining our navigation to thesame quarter value. The color was added simply to make it easier toverify and interpret the results.