Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello! Can someone explain me, please, why does
LET vMonthStart=MonthStart(max(Date));
//Date is a field of previously loaded table
cause a script line error?
Regards,
Alexa
Hi, try this.
LET vPeriod=$(vMaxDateNum)-$(vMonthStartNum);
Best Regards.
Tonial.
Hi,
You should use following expression:
LET vMonthStart=MonthStart(max(PEEK('Date')));
Hope this helps.
Andrei
Andrei, tahnks for your reply. But it doesn't work/ the same error=(
Hi Alexa,
check this one
let vmax = MonthStart(Peek('DateOfSale', -1));
BR
M
Hm...
So, you can try this construction:
abc:
LOAD * INLINE [
Date, Max
01.12.2015, 123
05.12.2016, 234
];
temp:
LOAD
max(Date) as MaxDate
resident abc;
LET vMonthStart = MonthsStart(PEEK('MaxDate'));
drop table temp;
Regards,
Andrei
Tmp_MaxDate:
Load
Max (Date) as MaxDate
Resident Previous_Table;
LET vMonthStart=MonthStart(FieldValue('MaxDate', 1));
I made like this
TempTable1: |
LOAD
Max( Date) as MaxDate |
Resident FACT;
Let vMaxDateNum = Num( Peek( 'MaxDate', 0, 'TempTable1'));
Let vMaxDate = Date( $(vMinDateNum));
LET vMonthStart=MonthStart($(vMaxDate));
LET vPeriod=$(vMaxDate)-$(vMonthStart);// to tell the truth, THIS variable is what I need
There is no error.
But it DOESNT WORK=((( only first variable is ok. I cant see other variables in my option of document....
what can be wrong?=(
and make sure, your dates are sorted ascending
Can you post a sample
Hi Alexa,
can you post an example? Peek should work for you. Though the 'max' won't work in the let like that, as peek only returns a single value, so max won't do anything.
You'll either need to load a new date field to use with the max within it, or ensure you data is order by date, so you can peek the last/first row depending on your ordering.
hope that helps
Joe