Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Good day!
There is a problem using the intervalmatch function.
In short: Having executed the script below,
despite the fact that the correct values are displayed in the Data manager,
when you try to use the sum () function in the visualization,
all values increase exactly 4 times.
Please tell me what is wrong with the script?
Script:
TransactionTable:
load * inline [org,mindate,maxdate,Date1,val
'rome','2019-01-01','2019-01-30','2019-01-20',200
'rome','2019-01-01','2019-01-30','2019-01-30',200
'igi','2019-01-01','2019-01-20','2019-01-10',300
'igi','2019-01-01','2019-01-20','2019-01-15',300];
NoConcatenate
Tr:
load org,mindate,maxdate
resident TransactionTable;
drop table TransactionTable;
MinMaxDate:
Load Min(mindate) as MinDate, Max(maxdate) as MaxDate resident Tr;
Let vMinDate = Peek('MinDate',-1,'MinMaxDate');
Let vMaxDate = Peek('MaxDate',-1,'MinMaxDate')+1;
Drop Table MinMaxDate;
MasterCalendar:
Load Date($(vMinDate) + RecNo() -1) AS Date
Autogenerate vMaxDate-vMinDate;
inner join (Tr) intervalmatch (Date) LOAD mindate,maxdate
resident Tr;
drop table MasterCalendar;
NoConcatenate
result:
Load org&Date as Key,*
resident Tr;
drop table Tr;
left join
dat:
load org1&Date1 as Key,val1;
load * inline [org1,Date1,val1
'rome','1/20/2019',200
'rome','1/30/2019',200
'igi','1/10/2019',300
'igi','1/15/2019',300];
You need to add distinct in the load of tr because org, mindate and maxdate are duplicated on your TransactionTable.
You need to add distinct in the load of tr because org, mindate and maxdate are duplicated on your TransactionTable.