Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

wrong values with customized double header in matrix

I use a custom calculated table for the header.
The measure DimensionMeasure is calculated within the following script:
The goal of the dimensionmeasure is to calculate the count of rows from fact_an cumul of 12 months where
 Fact_AN[Vitesse_Transf_Mois]<=
SELECTEDVALUE(Dim_VieillissementAN[ID_Tranche])
    DimensionMeasure =
   
    VAR a = SELECTEDVALUE(Dim_DateFicheAgent[ID_DateFicheAgent])
    VAR b =SELECTEDVALUE(Dim_VieillissementAN[ID_Tranche])
    RETURN
   
        CALCULATE (
    COUNTROWS(Fact_AN)
          ;
         Fact_AN[Vitesse_Transf_Mois]<=b;
             DATESBETWEEN (
            Dim_DateFicheAgent[ID_DateFicheAgent];
            NEXTDAY ( SAMEPERIODLASTYEAR (LASTDATE ( Dim_DateFicheAgent[ID_DateFicheAgent] ) ) );
            LASTDATE ( Dim_DateFicheAgent[ID_DateFicheAgent] )
     
        )
           
   
    )
the measure DimensionMeasure returns wrong values, it's almost the same value for all middle level in the matrix:
How to correct it?
I use a star schema which means; I have only one fact table `fact_an`.
The table fact is linked to dim_produit by code_produit.
The description of the table dim_produit:
    Codeproduit Dim5Rapport   Dim6rapport

I try
       Formules =
    VAR Top1 = SELECTEDVALUE ( EnteteRapportAgentClient[Top] )
    VAR Middle = SELECTEDVALUE ( EnteteRapportAgentClient[Middle] )
    VAR BottomIndex = SELECTEDVALUE ( EnteteRapportAgentClient[Index3] )
    VAR Val =
        SWITCH (
            TRUE ();
            Top1 = "Nombre de leads"; [Lead]+ 0;
            Top1 = "Affaires nouvelles" && BottomIndex <> 0; [AN]+0;
            Middle = "Total AN";[AN]+ 0;
            Middle = "Taux Transfo"; DIVIDE([AN];[Lead])
        )
    VAR ValF=
      
         IF(   Middle = "Taux Transfo";
            FORMAT ( Val; "0.0%" );
            FORMAT ( Val; "0" ))
    VAR Val2=
      IF (ValF="0";"";ValF
        )RETURN Val2

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

    I just test your provided report file, I can't find there is any error... Could you please provide some screen shots to describe your problem and your expected result? Thank you.

    Best Regards

    Rena

    • Anonymous's avatar
      Anonymous
      Not applicable

      Anonymous  It returns wrong values, it returns 2 everywhere which is wrong.

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Anonymous ,

        Then what's the correct values for these columns? 1?

        Best Regards

        Rena