Forum Discussion

jprousseau's avatar
jprousseau
Frequent Visitor
5 years ago
Solved

Measure not adding correctly

Hi 

 

i have measure not tally corectly.

Measure =
SUMX
(
VALUES (data[Contract] ),
CALCULATE ( AVERAGE( (data[Premium] ) )
)
)

 

The premium for the 1st 2 rows must only be added once.

 

Please see screenshot. 

 

amitchandak Angith_Nair 

  • Hi jprousseau ,

     

    Try the following measure:

    Measure_new1 = 
    var _summarize=SUMMARIZE('data',[Date].[Year],[Date].[Month],"1",[Measure_new])
    return
    IF(
    HASONEVALUE(data[Date].[Month]),[Measure_new],SUMX(_summarize,[1]))

     

     

    Best Regards,
    Henry

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

7 Replies

  • jprousseau 
    Try this way:

     

    Measure =
    SUMX
    (
     data,
      data[Premium]  
    )

     

     

    If you need to average:

     

    Measure =
    AVERAGEX
    (
     data,
      data[Premium]  
    )

     




  • v-henryk-mstf's avatar
    v-henryk-mstf
    Community Support

    Hi jprousseau ,

     

    According to your mistake, I did a test to get the correct result, refer to the following:

    Measure_new = 
    VAR _summarize =
        SUMMARIZE ( 'data', [User], [Contract], "1", [Measure] )
    RETURN
        IF ( HASONEVALUE ( data[User] ), [Measure], SUMX ( _summarize, [1] ) )

     

    Best Regards,
    Henry

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

      • v-henryk-mstf's avatar
        v-henryk-mstf
        Community Support

        Hi jprousseau ,

         

        Try the following measure:

        Measure_new1 = 
        var _summarize=SUMMARIZE('data',[Date].[Year],[Date].[Month],"1",[Measure_new])
        return
        IF(
        HASONEVALUE(data[Date].[Month]),[Measure_new],SUMX(_summarize,[1]))

         

         

        Best Regards,
        Henry

         

        If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.