I need a calculated measure that produces the same results as the Last non-empty semi-additive in SSAS. Here are the details:
I have a fact table setup like below. Promo is a measure and it is shown by Date and R (the key values are FK's to the appropriate dimension tables). R is a slow changing dimension, so below shows multiple Promo records for October for the same R value (Uni, as seen in the next screenshot).
Below is a snapshot of what I see when browsing the cube. the SUM measure is a sum of Promo for October and R=Uni. The second measure is me using the last non-empty semi additive aggregation in Enterprise edition. This returns the values I want. However, I have to build this in Standard edition, so I need to do it in mdx.
I've tried multiple, but no matter what I do, I keep getting "12" as the returned value, rather than 6. This needs to span the Date and R dimensions. Below are two of the more recent mdx queries I've tried, neither of which work. (Note that I use hierarchies in them)
attempt 1 (returns 12)
iif(isempty([Measures].[Promo]),([Dim R].[R Hierarchy].[R].prevmember,[Dim Date].[Year - Quarter - Month].[Month].prevmember,
Measures.[TEST]
),[Measures].[Promo])
attempt 2 (returns blank value)
Tail(NonEmpty([Dim Date].[Month],[Measures].[Promo]),1).item(0)
Any help is appreciated