The below is a dynamic measure (using a disconnected table) for measures [measure 1], [measure 2], [measure 3] ... [measure n] which is wrapped inside a prior year calculation.
Unfortunately, [measure 3] actually requires an AVERAGEX as opposed to SUMX. Can anyone think of an elegant way to re-arrange this to account for this adjustment?
Unfortunately, [measure 3] actually requires an AVERAGEX as opposed to SUMX. Can anyone think of an elegant way to re-arrange this to account for this adjustment?
Code:
[COLOR=#FFFFFF][FONT=Consolas]Dynamic PY CSC :=[/FONT][/COLOR]
Dynamic Measure - PY :=
IF (
HASONEVALUE ( 'Dynamic Measures'[ID] ),
SUMX (
VALUES ( 'Time Filters'[YearPeriodNumber] ),
CALCULATE (
SWITCH (
VALUES ( 'Dynamic Measures'[ID] ),
1, [measure 1],
2, [measure 2],
3, [measure 3]
),
ALL ( 'Time Filters' ),
FILTER (
ALL ( 'Time Filters'[YearPeriodNumber] ),
'Time Filters'[YearPeriodNumber]
= EARLIER ( 'Time Filters'[YearPeriodNumber] ) - 12
)
)
)
)