Forum Discussion
marcofalzone01
4 years agoRegular Visitor
Calculate not accumulated amounts from accumulated data structure
Sorry for being so verbous, it's my very first post on this community. I have source data structured as follows: Periods or Index Field Other Category Accumulated Amounts 1 A ...
KT_Bsmart2gethe
Impactful Individual
4 years agoHi marcofalzone01 ,
Based on the attached file, keep the first two steps (i.e. delete everything from the pivot step).
Then, add a custom column and add code below:
[Accumulated Amount] -
List.Sum(
List.InsertRange(
Table.SelectRows(
#"Changed Type",
(x)=>
x[Periods or Index Field]
= [Periods or Index Field] - 1
and
x[Other Category]
= [Other Category]
)[Accumulated Amount]
,0,{0}
)
)
You should get the result below:
The code contains two criteria: Other Category and Index.
Regards
KT
AlexisOlson
Super User
4 years agoKT_Bsmart2gethe This can work but is highly inefficient when the tables get very large.
marcofalzone01 I'd recommend checking out these prior similar posts:
https://community.powerbi.com/t5/Desktop/Calculating-Daily-values-from-Cumulative-Total/m-p/2198969
- KT_Bsmart2gethe4 years ago
Impactful Individual
AlexisOlson, I 100% agree with you.