Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
charliota
Partner - Contributor II
Partner - Contributor II

Build an accumulated metric in a straight table based on multiple dimensions

Hello everyone,


I’m having trouble building a KPI in a straight table, since I need it to accumulate and reset whenever it encounters a different material code. Below is an example:

charliota_0-1757601550471.png

 

I need to generate the column "Unidades Acum" and I have tried the following formula:

 

rangesum(above(sum(Unidades),0,RangeSum(Above(if(only(CodMaterialSAP)=above(total CodMaterialSAP),1,0), 1, RowNo()))))

 

Do you have any idea? Thanks in advance!

Labels (3)
4 Replies
QFabian
MVP
MVP

Hola @charliota , one option is create the accumulation in script, using inter record functions like peek() and previous()

https://help.qlik.com/es-ES/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/InterReco...

 

Example script :

Data:
Load * INLINE [
Cod Material, Almacen, Fecha Caducidad, Unidades
A, 1, 20/09/2025, 10 
A, 2, 20/09/2025, 50 
A, 3, 22/09/2025, 60 
A, 4, 23/09/2025, 50 
B, 5, 20/09/2025, 10 
B, 6, 23/09/2025, 20 
B, 7, 24/09/2025, 30 
];
 
 
Output:
Load
    [Cod Material], 
    Almacen, 
    [Fecha Caducidad], 
    Unidades,
    if([Cod Material] = previous([Cod Material]), Unidades + peek([Unidades Acumuladas]), Unidades) as [Unidades Acumuladas]
Resident Data;
drop table Data;
 

 

This is the resulting table

QFabian_0-1757606969739.png

 

Greetings!! Fabián Quezada (QFabian)
did it work for you? give like and mark the solution as accepted.
charliota
Partner - Contributor II
Partner - Contributor II
Author

Thanks for the response QFabian, but I need to do this on the Front-End since it has to be dynamic... any other option to do it at the object level instead of the script level?

Thanks in advance!

QFabian
MVP
MVP

@charliota  I almost forgot that we have accumulation as expression propertie!!!!!!

QFabian_0-1757621743060.png

Así queda, como la acumulación aguanta hasta 2 dimensiones, pasé la fecha como expresión :

QFabian_0-1757622790349.png

 

 

 

Greetings!! Fabián Quezada (QFabian)
did it work for you? give like and mark the solution as accepted.
charliota
Partner - Contributor II
Partner - Contributor II
Author

Thanks for the response, but it doesn’t work for me when I have 3 dimensions in the table. Any other idea?