Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Théo
Contributor II
Contributor II

IntervalMatch with variable products

Hi everybody,

I'm working on a dataset and I have to use (i think) the intervalmatch function. I would like to mix two tables, the first one is a calendar, with days from the first of january 19, and the other table is the geografical position of my products during interval periods.

 

I'll give you an exemple:

The product ADBH is in Canada from 01/01/2019 to 05/06/2020,  in Brasil from 05/06/2020 to 02/04/2021 and in Spain from 02/04/2021 to 16/09/2021.

So, I have to input every single day from 01/01/2019 the position on the product ADBH. Of course, I have a lot of product, not just one.

I would have this presentation:

ADBH 01/01/2019 Canada

ADBH 02/01/2019 Canada

.

.

.

ADBH 08/09/2020 Brasil

ADBH 09/09/2020 Brasil

Could someone help me to unblock this situation? Thank you

 

Théo

2 Replies
QFabian
MVP
MVP

Hi @Théo , try this option :

 

GP_Aux:
Load * INLINE [
Product, GP, FROM, TO
ADBH, Canada, 01/01/2019, 05/06/2020
ADBH, Brasil, 05/06/2020, 02/04/2021
ADBH, Spain, 02/04/2021, 16/09/2021
];

Let vRows = NoOfRows('GP_Aux') - 1;


For vRow = 0 to $(vRows)

Let v_Product = peek('Product', $(vRow), 'GP_Aux');
Let v_GP = peek('GP', $(vRow), 'GP_Aux');
Let v_FROM = num(peek('FROM', $(vRow), 'GP_Aux'));
Let v_TO = num(peek('TO', $(vRow), 'GP_Aux'));

For v_NewRow = $(v_FROM) to $(v_TO)
GP:
Load
'$(v_Product)' as Product,
'$(v_GP)' as GP,
date($(v_NewRow)) as Date
Autogenerate(1);
Next
Next

drop table GP_Aux;

Greetings!! Fabián Quezada (QFabian)
did it work for you? give like and mark the solution as accepted.
Théo
Contributor II
Contributor II
Author

Hi Fabian,

 

Sorry, It's not working...

 

Théo