Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

% Change over user selected year columns

Hi all,   First time poster! I'd appreciate any help you can give me with this question...   I need to create a dynamic matrix and line chart that shows the percentage change over selected year c...
  • gmsamborn's avatar
    2 years ago

    Hi Anonymous 

    Maybe try something like this.

     

    Pct Chg = 
    VAR _CurrentSelected = [Total Value]
    VAR _PreviousSelected =
        CALCULATE(
            [Total Value],
            OFFSET(
                -1,
                ALLSELECTED( 'Table'[Year] ),
                ORDERBY( 'Table'[Year] )
            )
        )
    VAR _Logic =
        DIVIDE(
            _CurrentSelected - _PreviousSelected,
            _PreviousSelected
        )
    RETURN
        _Logic