Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Optimize SUMX / SUMMARIZE Measure

Hi everyone,  I'm writting here to get some help to optimize the calculation of one of my measure that takes too much time to compute (10 seconds everytime you click on something / expand a row) ...
  • Kucrapok's avatar
    5 years ago

    Hello, I'm not sure if you have figured out why it was slow, but I think it's probably 
    your if statement in your SUMX.

    SummedPriceImpact =
    SUMX (
        SUMMARIZE (
            'Fact',
            'Customer'[Sales Team],
            'Customer'[Sales Man],
            'Customer'[Customer],
            'Store'[Store],
            'Article'[Article]
        ),
        [PriceImpact]
    )

    I see 2 things :
    1) [PriceImpact] triggers Context transition for each iteration which is bad with a Big Fact table
    2) You should always avoid using IF statement inside an Iterator like SUMX. The use of IF statement will require a call to the Formula Engine for each iteration and the iteration is done by the Vertipaq engine.

    One solution to speed up the process would be to precalculated your [PriceImpac] measure inside a Calculated column in your Article Dimension. It will be stored in memory.

    Maybe I did not understand your problem very well and this won't work for you.

    Also 2M rows is nothing for a Tabular model. You should be able to have a speed < 1sec like the other person said earlier.