Forum Discussion
get previous Round value
hello...
I have a fact
| id | val | round |
| 1 | 10 | 1 |
| 2 | 2 | 1 |
| 3 | 1 | 1 |
| 4 | 20 | 11 |
| 5 | 15 | 30 |
| 6 | 15 | 30 |
and I have a round Dim wich related to column round in the fact
| ID | DESC | order |
| 1 | ROUND 1 | 1 |
| 11 | ROUND 2 | 2 |
| 30 | ROUND 3 | 3 |
I need to find sum of values in round for previous round...
the output should be like
| Column1 | sum of value | Previous ROUND VALUE |
| ROUND 1 | 13 | |
| ROUND 2 | 20 | 13 |
| ROUND 3 | 30 | 20 |
Assuming that the [order]-column can be used to identify the order of the rounds and that you have a relationship between table[round] and dimRound[ID], you can create this measure:
Value previous round = CALCULATE ( sum(Table[val])); FILTER ( ALL ( dimRound ); dimRound[order] = SELECTEDVALUE ( dimRound[order] ) - 1 ) )- Anonymous6 years ago
thank you>>
Measure22:=CALCULATE (
SUM ( Table1[VAL] ),
FILTER (
ALL ( Table2),
Table2[order] = IF (HASONEVALUE(Table2[order] ), VALUES ( Table2[order]) - 1 )
)
)
2 Replies
- sturlawsResident Rockstar
Assuming that the [order]-column can be used to identify the order of the rounds and that you have a relationship between table[round] and dimRound[ID], you can create this measure:
Value previous round = CALCULATE ( sum(Table[val])); FILTER ( ALL ( dimRound ); dimRound[order] = SELECTEDVALUE ( dimRound[order] ) - 1 ) )- AnonymousNot applicable
thank you>>
Measure22:=CALCULATE (
SUM ( Table1[VAL] ),
FILTER (
ALL ( Table2),
Table2[order] = IF (HASONEVALUE(Table2[order] ), VALUES ( Table2[order]) - 1 )
)
)