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
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))
Obervation | Customer | Location | Product | Sales |
5 | 381101 | NY | 34221 | 43241 |
5 | 381101 | NY | 14321 | 12321 |
6 | 381101 | NY | 34223 | 13413 |
6 | 381101 | NY | 65446 | 13124 |
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
Post a Comment