i need a little help to figure out a problem i have in MDX. I want to show the last version per period of a measure even if the value is NULL. But my code show me the last non empty version.
Example :
Here is my code : (the visible measure in the tables is MNY_ENCOURS)
SCOPE([DIM Version].[VCR BK Version].[All]);
[Measures].[MNY_AA_Total] = tail(filter([DIM Version].[VCR BK Version].[All], not isempty([Measures].[MNY_AA_Total])));
[Measures].[MNY_ENCOURS] = tail(filter([DIM Version].[VCR BK Version].[All], not isempty([Measures].[MNY_ENCOURS])));
[Measures].[MNY_Flottement] = tail(filter([DIM Version].[VCR BK Version].[All], not isempty([Measures].[MNY_Flottement])));
[Measures].[MNY_Montant_Cale] = tail(filter([DIM Version].[VCR BK Version].[All], not isempty([Measures].[MNY_Montant_Cale])));
[Measures].[MNY_VARIATION_ENCOURS] = tail(filter([DIM Version].[VCR BK Version].[All], not isempty([Measures].[MNY_VARIATION_ENCOURS])));
[Measures].[V FCT Collecte Count] = tail(filter([DIM Version].[VCR BK Version].[All], not isempty([Measures].[V FCT Collecte Count])));
[Measures].[CONFI_FLUX] = tail(filter([DIM Version].[VCR BK Version].[All], not isempty([Measures].[CONFI_FLUX])));
[Measures].[CONFI_STOCKS] = tail(filter([DIM Version].[VCR BK Version].[All], not isempty([Measures].[CONFI_STOCKS])));
[Measures].[Declarant_Distinct_Count] = tail(filter([DIM Version].[VCR BK Version].[All], not isempty([Measures].[Declarant_Distinct_Count])));
[Measures].[MNY_FLUX_CALCULE] = tail(filter([DIM Version].[VCR BK Version].[All], not isempty([Measures].[MNY_FLUX_CALCULE])));
[Measures].[PART_FLUX_Trimestriel]=tail(filter([DIM Version].[VCR BK Version].[All], not isempty([Measures].[PART_FLUX_Trimestriel])));
[Measures].[PART_STOCKS]= tail(filter([DIM Version].[VCR BK Version].[All], not isempty([Measures].[PART_STOCKS])));
END SCOPE;
Can you please help me ? Thank you
Why not just move from this pattern for each measure:
...
[Measures].[MNY_ENCOURS]
= TAIL(
FILTER(
[DIM Version].[VCR BK Version].[All]
, not isempty([Measures].[MNY_ENCOURS])
)
...
to a tuple, like the following, for each:
...
[Measures].[MNY_ENCOURS]
= (
tail([DIM Version].[VCR BK Version].[All].MEMBERS).ITEM(0).ITEM(0)
,[Measures].[MNY_ENCOURS]
)
...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With