Forum Discussion

Nikolainoergard's avatar
Nikolainoergard
Frequent Visitor
2 years ago
Solved

LTM measure issue

Hi I have a volume effect measure that I'm having issues with when applying an LTM calculation. I believe it's related to a context issue. This itself works fine: Volume effect = [Sales PY] * DIV...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi, Nikolainoergard 

    Based on your information, I create a sample table:

    Then create a calculated column and try the following DAX expression:

    Volume effect = [Sales_PY] * DIVIDE([Trench_Volume], [Trench_Volume_PY]) - [Sales_PY]

     

    Create a measure:

    Volume Effect LTM = 
    VAR _MaxPeriod = MAX('Table'[Calendar_ConsecutiveFiscalPeriod])
    VAR _MinPeriod = _MaxPeriod - 12
    VAR _Result =
        CALCULATE(
            SUM('Table'[Volume effect]), 
            ALL('Table'),
                'Table'[Calendar_ConsecutiveFiscalPeriod] <= _MaxPeriod &&
                'Table'[Calendar_ConsecutiveFiscalPeriod] > _MinPeriod
        )
    RETURN
        _Result

    Here is my preview:

     

    How to Get Your Question Answered Quickly 

    Best Regards

    Yongkang Hua

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