Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

partial month calculation

year month amount       year month  amount 2017 1 1000       2017 1 1000 2017 2 3000       2017 2 2000 2017 3 7000   wanted result->   2017 3 4000 2017 ...
  • v-danhe-msft's avatar
    v-danhe-msft
    7 years ago

    Hi Anonymous,

    Maybe you could try to modify the formula as below:

    Column =
    VAR a = 'Table1'[month] - 1
    RETURN
        [amount]
            - CALCULATE (
                SUM ( Table1[amount] ),
                FILTER (
                    'Table1',
                    'Table1'[month] = a
                        && 'Table1'[year] = EARLIER ( Table1[year] )
                        && 'Table1'[code] = EARLIER ( Table1[code] )
                        && 'Table1'[company] = "dk"
                )
            )
    

    Regards,

    Daniel He