Announcements
cancel
Showing results for
Did you mean:
Contributor III

## Intervalmatch problem

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:
'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:
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:
resident Tr;
drop table Tr;
left join
dat:
'rome','1/20/2019',200
'rome','1/30/2019',200
'igi','1/10/2019',300
'igi','1/15/2019',300];

Labels (4)

• ### Script

1 Solution

Accepted Solutions
Employee

You need to add distinct in the load of tr because org, mindate and maxdate are duplicated on your TransactionTable.