Forum Discussion
How can I calculate an increment between two accumulated values?
- 6 years ago
Hi, Try this:
1. Add a Index Column
2. Add a Custom Column
try #"Added Index"{[Index]}[CasesAcum]-#"Added Index" {[Index]-1}[CasesAcum] otherwise 0Regards
Victor
- 6 years ago
Finally I've created a new formula to detect the change of name and that's solved
= Table.AddColumn(#"Índice agregado", "Cases", each if #"Índice agregado"{[Índice]}[#"Name"] = #"Índice agregado"{[Índice]-1}[#"Name"] then #"Índice agregado"{[Índice]}[#"CasesAcum"]-#"Índice agregado"{[Índice]-1}[#"CasesAcum"] else 0)
Thank you Victor
Hi, Try this:
1. Add a Index Column
2. Add a Custom Column
try #"Added Index"{[Index]}[CasesAcum]-#"Added Index" {[Index]-1}[CasesAcum] otherwise 0
Regards
Victor
Hello Victor, I've tried the expression that you said but I have big problems with the performance when is loading data.
This solition is non-viable.
Do you know how to create the same column from DAX? because woth powerquery doesn't work.
I don't know why bit to access the rows through the index position is very slow.
Thank toy in advance
- Vvelarde6 years ago
Community Champion
Try with this Dax Calculated Column:
Mycolumn = 'Table'[CasesAcum] - CALCULATE ( FIRSTNONBLANK ( 'Table'[CasesAcum]; 'Table'[CasesAcum] ); TOPN ( 1; FILTER ( 'Table'; 'Table'[Name] = EARLIER ( 'Table'[Name] ) && 'Table'[Date] < EARLIER ( 'Table'[Date] ) ); 'Table'[Date]; DESC ) )Or
Mycolumn = 'Table'[CasesAcum] - CALCULATE ( LASTNONBLANK ( 'Table'[CasesAcum]; 'Table'[CasesAcum] ); FILTER ( 'Table'; 'Table'[Name] = EARLIER ( 'Table'[Name] ) && 'Table'[Date] < EARLIER ( 'Table'[Date] ) ) )Regards
Victor