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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
abTech
Contributor III
Contributor III

Qlik sense Variables

I got the data uploaded to QLIK sense i want to create a variable to pick just the last value according to max date.
in the sample the variable value should be 1500.

Screenshot 2024-08-28 102230.png

Labels (4)
5 Replies
nina2
Contributor III
Contributor III

Hello, 

Try to declare a variable with the following expression:

sum({$<Date={'$(=max(Date))'}>}[Sales])

Regards, 

Nina

abTech
Contributor III
Contributor III
Author

Thank you for collaboration, but Actually i do not need to sum the sales column i want just the latest value if you understand me. Thank you again !!!

nina2
Contributor III
Contributor III

Can we have more details ?

If you have two lines with the same max date, what do you want ? 

abTech
Contributor III
Contributor III
Author

OK, lets pretend that the data is updated from time to time, and i have to create this variable to hold the latest value without the summation of the total values. i have tried the AGGR function but the output is not what i expected.

nina2
Contributor III
Contributor III

Do you have an hour of the add/update ? 

If so, it will be easier

If not, i think the best is to declare the variable in your script

You can try to order your values in the table and then use the "pick" function to have the latest value

For example on the "TABLE1":

TABLE1:

LOAD * INLINE [
NUM, DATE, SALES
1, 02/08/2024, 1254
2, 25/08/2024, 9999
3, 05/04/2024, 54
4, 02/05/2023, 1564
5, 31/07/2024, 543
6, 29/01/2022, 244
7, 25/08/2024, 4354,
8, 22/07/2023, 5546
]
;

 

NoConcatenate

TABLE2:

LOAD NUM,
DATE,
SALES

resident TABLE1
ORDER BY DATE, NUM
;

 

let vVariable=Peek('SALES');

drop table TABLE2;