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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

RangeSum Script for Dimension

Hi,

I need RangeSum for Category. How to build this function in my script for this table?

Final table should be

A,1,10;

A,3, 25;

D,2,5;

D,3,10

Test:

LOAD * INLINE [

    Category, K, Value  

    A, 1, 10

    A, 3, 15

    D, 2, 5

    D, 3, 5       

];

Tmp_Test:

NoConcatenate

Load

     Category,

    K,

    RangeSum(Value) as Cum

Resident Test;

1 Reply
swuehl
MVP
MVP

Try with inter-record functions like Peek() / Previous() :

Tmp_Test:

NoConcatenate

Load

     Category,

    K,

   If(Peek(Category)= Category,RangeSum(Value, Peek(Cum)),Value) as Cum

Resident Test

ORDER BY Category, K; // may need an appropriate sort of the input table if your input table is not sorted as needed.