In Figure 1 the Subtotal value highlighted in red is based on non-smart metric and the one highlighted in green is a smart metric Subtotal.Unit Cost Average metric Subtotal calculation is based on the values that can be seen in the report template. Unit Cost Average metric Subtotal is calculated based on the values that are already aggregated on the Quarter level. Unit Cost Average (Smart) metric Subtotal is based on the average calculation in the original data level (Fact table level). Unit Cost Average (Smart) metric is based on the Unit Cost Sum and Unit Count metrics shown in the last two columns. The next sections describe how to design the metrics with detailed explanation on which type of formula is used with each of the metrics. The last section describes how the results are generated by the Analytical Engine.
Figure 1

Formulas used in the Subtotal calculations:
Unit Cost Average: | >> Explanation: | Unit Cost Average (Smart): | >> Explanation: |
73,487 + 71,530 + 71,377 + 73,239 + 73,349 + 71,497 + 72,841 + 74,657 + 73,469 + 72,189 + 72,287 + 73,090 = 873,012 | >> The averages for each quarter are summed | 56.808.729 / 780.466 = 72,788 | >> Fact level Unit Cost Sum Total is divided by Unit Count Total |
873,012 / 12 = 72,751 | >> The Quarter level average total (sum of all quarters) is divided by total amount of Quarters | -- | -- |
72,751 | >> Average Subtotal for already aggregated values | 72,788 | >> Average Subtotal for original data level values |
Figure 2.

Figure 3.

Smart metric functionality is used in this example as illustrated in Figure 5. This means that the Unit Cost Sum and Unit Count metric fact level Total values are used for the compound metric calculations. This means that the results calculated in the Subtotals are based on the original data level calculations. Figures 4 and 5 are describing the Unit Cost Average (Smart) metric. The metric values are shown in the second column in Figure 1.
Figure 4.

Figure 5.

select a12. AS QUARTER_ID,
max(a13.) AS QUARTER_DESC,
avg(a11.) AS WJXBFS1
from a11,
a12,
a13
where a11. = a12. and
a12. = a13.
group by a12.
select a12. AS QUARTER_ID,
max(a13.) AS QUARTER_DESC,
count(a11.) AS WJXBFS1,
sum(a11.) AS WJXBFS2
from a11,
a12,
a13
where a11. = a12. and
a12. = a13.
group by a12.
19607