Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MDX Doesn't show last version of data

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 :

My problem

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

like image 889
Reda Maachi Avatar asked Jan 04 '18 09:01

Reda Maachi


1 Answers

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]
    )
...
like image 189
whytheq Avatar answered Oct 31 '22 18:10

whytheq