Forum Discussion

Sasha's avatar
Sasha
Icon for Helper III rankHelper III
8 years ago
Solved

SUMX on one column

Hi,

I was wondering if there might be a case when we'll prefare using SUMX over SUM even if it involves just one column?

Thanks

Alex

  • Sasha

     

    Interesting!!

     

    May be when you need to do some calculation on individual values of the Column before summing them up

     

    For example

     

    Measure =
    SUMX (
        ALLSELECTED ( Table1[Column] ),
        IF ( [Column] < 3, [Column] * 10, [Column] * -10 )
    )

    Also SUMX is the only option when you have to sum the columns of a temporary table created using a VARIABLE

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Sasha 

     

    SUMX uses Row context , so SUMX is preferred if you need row based data .

     

    Thanks
    Raj

  • Zubair_Muhammad's avatar
    Zubair_Muhammad
    Icon for Community Champion rankCommunity Champion

    Sasha

     

    Interesting!!

     

    May be when you need to do some calculation on individual values of the Column before summing them up

     

    For example

     

    Measure =
    SUMX (
        ALLSELECTED ( Table1[Column] ),
        IF ( [Column] < 3, [Column] * 10, [Column] * -10 )
    )

    Also SUMX is the only option when you have to sum the columns of a temporary table created using a VARIABLE