Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Attend QlikWorld 2020 and hear keynote speaker, Malcolm Gladwell. Register by February 29th to save $200. Learn More
Highlighted
stanlyrj
New Contributor III

How join can be used with intervalmatch()

Hi,

I'm new to Qlik View. I'm working on an exercise and I'm facing a problem which I'm not able to find a solution.

Here I have two tables Facts and Sales_Territory. (Shown as in the below Image)Tables.JPG

I want to join the field EmployeeID(from table SalesTerritory) to the table Facts(As shown in the below Image).

Desiered Output.JPG

I have used the following script for this.

Facts:

Load * From

[lib://QVD\Tra\Facts\SalesOrder.qvd](qvd);

SalesTerritory:

Load *

From [lib://QVD\Tra\Dims\SalesTerritory.qvd](qvd);

Join

IntervalMatch(OrderDate,TerritoryID)

Load StartDate,EndDate,TerritoryID Resident SalesTerritory;

left join(Facts)

Load

    TerritoryID,

    EmployeeID

Resident SalesTerritory;

But this does not give the desired output. Can anyone help me, please...........

Thank You

Stanly R Johns

Tags (2)
1 Solution

Accepted Solutions
Highlighted
thomaslg_wq
Contributor III

Re: How join can be used with intervalmatch()

Hi,

hehe it's a little bit tricky.

This script will do it, you just have to understand it now. Tell me if you miss something:

Territories:

LOAD

    Territoy_ID&'/'&StartDate&'/'&EndDate as Territory_From_To,

    Territoy_ID,

    Employee_ID,

    StartDate,

    EndDate

FROM [lib://desktop/Classeur1.xlsx]

(ooxml, embedded labels, table is Territory);

Sales:

LOAD

  Territoy_ID&'/'&"Order Date" as Territory_Date,

    SalesOrderID,

    Territoy_ID as Territoy_ID_Temp,

    "Order Date",

    Amount

FROM [lib://desktop/Classeur1.xlsx]

(ooxml, embedded labels, table is Fact);

Temp:

Intervalmatch([Order Date],Territoy_ID_Temp)

LOAD

   StartDate,

    EndDate,

    Territoy_ID as Territoy_ID_Temp

resident Territories;

outer join(Territories)

LOAD

Territoy_ID_Temp&'/'&[Order Date] as Territory_Date,

Territoy_ID_Temp&'/'&StartDate&'/'&EndDate as Territory_From_To

resident Temp;

Drop table Temp;

View solution in original post

2 Replies
Highlighted
thomaslg_wq
Contributor III

Re: How join can be used with intervalmatch()

Hi,

hehe it's a little bit tricky.

This script will do it, you just have to understand it now. Tell me if you miss something:

Territories:

LOAD

    Territoy_ID&'/'&StartDate&'/'&EndDate as Territory_From_To,

    Territoy_ID,

    Employee_ID,

    StartDate,

    EndDate

FROM [lib://desktop/Classeur1.xlsx]

(ooxml, embedded labels, table is Territory);

Sales:

LOAD

  Territoy_ID&'/'&"Order Date" as Territory_Date,

    SalesOrderID,

    Territoy_ID as Territoy_ID_Temp,

    "Order Date",

    Amount

FROM [lib://desktop/Classeur1.xlsx]

(ooxml, embedded labels, table is Fact);

Temp:

Intervalmatch([Order Date],Territoy_ID_Temp)

LOAD

   StartDate,

    EndDate,

    Territoy_ID as Territoy_ID_Temp

resident Territories;

outer join(Territories)

LOAD

Territoy_ID_Temp&'/'&[Order Date] as Territory_Date,

Territoy_ID_Temp&'/'&StartDate&'/'&EndDate as Territory_From_To

resident Temp;

Drop table Temp;

View solution in original post

Highlighted
stanlyrj
New Contributor III

Re: How join can be used with intervalmatch()

Hi Thomas,

Thank you so much for your reply.

Your script worked perfectly and I got the solution for the problem. This is my very first post on Qlik Community and I got the correct answer in the first reply itself. I'm so happy.

Thanks again! 

Best Regards,

Stan