Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I am very new to qlik please suggest me something for the below issue:
I need to create a flag containing values Y and N.
I have created these two columns Date and Latest Date from csv file Date_key column and saving in qvd file.
my code is like this:
Date Latest Date Flag
22/08/2016 22/08/2016 Y
23/08/2016 22/08/2016 N
24/08/2016 22/08/2016 N
25/08/2016 22/08/2016 N
and the i am using the below code to create the flag
Load
if(Date = Latest Date,'Y','N') as MaxDate
Resident Dummy;
Thanks in Advance.
Hi,
Its output is coming like this:
Date Latest Date Flag
22/08/2016 22/08/2016 Y
23/08/2016 22/08/2016 N
24/08/2016 22/08/2016 Y
25/08/2016 22/08/2016 N
which is not correct.
Isn't that correct?
You wanted Y or N as flag.
You have condition placed as well...then what more you need?
You want Min & Max or Flag?
Hi,
My script :
LOAD
If(Date = [Latest Date], 'Y', 'N') as tt,
Date,
[Latest Date]
INLINE [
Date , Latest Date
22/08/2016, 22/08/2016
23/08/2016 , 22/08/2016
24/08/2016 , 22/08/2016
25/08/2016 , 22/08/2016
];
And the result :
Date | Latest Date | tt |
---|---|---|
22/08/2016 | 22/08/2016 | Y |
23/08/2016 | 22/08/2016 | N |
24/08/2016 | 22/08/2016 | N |
25/08/2016 | 22/08/2016 | N |
Aurélien
Hi all,
Thanks for your replies.
have got the solution for it.
i am creating a temp table to find out the max date:
RecentWeekvalue:
Load
Date(max(weekendDate), 'DD/MM/YYYY') as RecentWeek
Resident Calendar;
store this value in variable:
we need to use peek because it will get the first value from max.
let vRecentWeek =Peek('RecentWeek',0,'RecentWeekvalue');
and then compare it :
and important is keep your variable in single quotes only then it will work:
IF (weekendDate = '$(vRecentWeek)','Y','N') as MostRecentWeek,
Thanks all for the solutions.