Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
mrichman
Creator II
Creator II

Does anyone know how to get the value of a max column then save this into a LET variable?

Hi Community, 

 

I would like to get a value from a max FileTime/Date, then save this value into a LET variable which I will use as column for another table. 

Example

Load * Inline [
Week, FileTime
Week 1, 1-1-2019
Week 2, 2-1-2019
Week 3, 3-1-2019
]

The max value for this table should be Week 3 as the max FileTime(Date) is 3-1-2019..

I want then to save Week 3 into a  LET variable...

Load 
$('Here variable '), 
Testfield
Resident Test.

 

Do you guys have any idea? 


Thanks in advance! 

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Table1:
Load Week, Date(Date#(FileTime,'D-M-YYYY'),'D-M-YYYY') as FileTime Inline [
Week, FileTime
Week 1, 1-1-2019
Week 2, 2-1-2019
Week 3, 3-1-2019
];

Table2:
LOAD FirstSortedValue(Week, -FileTime) as MaxWeek RESIDENT Table1;

LET vMaxWeek = Peek('MaxWeek',0,'Table2');


talk is cheap, supply exceeds demand

View solution in original post

2 Replies
Gysbert_Wassenaar

Table1:
Load Week, Date(Date#(FileTime,'D-M-YYYY'),'D-M-YYYY') as FileTime Inline [
Week, FileTime
Week 1, 1-1-2019
Week 2, 2-1-2019
Week 3, 3-1-2019
];

Table2:
LOAD FirstSortedValue(Week, -FileTime) as MaxWeek RESIDENT Table1;

LET vMaxWeek = Peek('MaxWeek',0,'Table2');


talk is cheap, supply exceeds demand
mrichman
Creator II
Creator II
Author

Thanks!