power bi sum of previous rows

This can be done via DAX query SUM, CALCULATE & FILTER I am providing one scenario and DAX query for the same , you all can create your queries based on sample provided below

ObervationCustomerLocationProductSales
5381101NY3422143241
5381101NY1432112321
6381101NY3422313413
6381101NY6544613124

for this we can use following Query

Total Sales := SUM(MyTable[Sales])
Prev Sales := CALCULATE([Total Sales], FILTER(ALL(MyTable[Observation]), MyTable[Observation] = MAX(MyTable[Observation]) - 1))

Comments

Popular Posts