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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
tracycrown
Specialist
Specialist

Memory Variable Script

Dear all

Kindly advise how to write a simple script to store the record numbers (Period) and values (Sales) of first & last records as memory variables for Period (P1=1 & P2=16) and Sales (T1=4.8 & T2=8.4).

Thank you

Tracy

Labels (1)
2 Solutions

Accepted Solutions
rubenmarin
MVP
MVP

Hi Tracy, if you add a condition to retrieve only files with sales:

Where Len(Trim(Sales))>0;

 

The variables can be created like:

LET P1 = Peek('t',0,'Sales');
LET T1 = Peek('Sales',0,'Sales');
LET P2 = Peek('t',NoOfRows('Sales')-1,'Sales');
LET T2 = Peek('Sales',NoOfRows('Sales')-1,'Sales');

View solution in original post

tracycrown
Specialist
Specialist
Author

Dear Rubenmarin
Thank you so much for your help, you are very helpful.
Wishing you and your family a Happy, Healthy and Prosperous New Year 2019.
Tracy

View solution in original post

2 Replies
rubenmarin
MVP
MVP

Hi Tracy, if you add a condition to retrieve only files with sales:

Where Len(Trim(Sales))>0;

 

The variables can be created like:

LET P1 = Peek('t',0,'Sales');
LET T1 = Peek('Sales',0,'Sales');
LET P2 = Peek('t',NoOfRows('Sales')-1,'Sales');
LET T2 = Peek('Sales',NoOfRows('Sales')-1,'Sales');

tracycrown
Specialist
Specialist
Author

Dear Rubenmarin
Thank you so much for your help, you are very helpful.
Wishing you and your family a Happy, Healthy and Prosperous New Year 2019.
Tracy