Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Community,
I have a problem with a variable whichI don't know why is set to NULL.
The situation is as follows.
1. I have a date field from table GA
2. I have a second date field from table PS
3. What I want to get is the most recent date of the two fields, then compare them and keep the biggest one, i.e. the most recent date in numeric format
4. What I've done is to load the two fields and use two different variables MaxDate_1 and MaxDate_2 to store the biggest (most recent) date of the two differente fields. After that I wanted to use a third variable to store the maximum of MaxDate_1 and MaxDate_2 and here is where the problem comes.
I've checked the variables and MaxDate_1 and MaxDate_2 store numeric values (it seems that part works) but MaxDate is ends up being NULL
5. Could you please check the end line and tell me if there is any syntax mistake?
Thanks in advance.
---
GA:
LOAD
"Date"
FROM [xxx];
PS:
LOAD
invoice_date
FROM [xxx];
Temp:
LOAD
Max("Date") as MaxDate_1
Resident GA;
LET vMaxDate_1 = floor(peek('MaxDate_1'));
Drop Table Temp;
Temp:
LOAD
Max("invoice_date") as MaxDate_2
Resident PS;
LET vMaxDate_2 = floor(peek('MaxDate_2'));
Drop Table Temp;
Drop Table GA;
Drop Table PS;
LET vMaxDate = if(MaxDate_1>MaxDate_2,MaxDate_1,MaxDate_2);
Hi
You assigned vMaxDate_1 and used MaxDate_1 in your expression. Same with vMaxDate_2
LET vMaxDate = if(vMaxDate_1>vMaxDate_2,vMaxDate_1,vMaxDate_2);
HTH
Jonathan
Try: LET vMaxDate = if($(MaxDate_1)>$(MaxDate_2),$(MaxDate_1),$(MaxDate_2));
- Marcus
Hi
You assigned vMaxDate_1 and used MaxDate_1 in your expression. Same with vMaxDate_2
LET vMaxDate = if(vMaxDate_1>vMaxDate_2,vMaxDate_1,vMaxDate_2);
HTH
Jonathan
Or I would use RangeMax to simplify it a little:
LET vMaxDate = RangeMax(vMaxDate_1, vMaxDate_2);
Thanks Marcus.
Didn't work.
Still NULL.
That was it.
Many thanks and also for the additional recommendation.
M.