Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
yipchunyu
Creator
Creator

Interval match to check award level

I have a sale fact table group by individual sales level like:

 sales, case count, sales amount

We are going to award the sales based on either the case count or the sales amount

So, I build a requirement table, sth like below

LevelAwardRequirementAmtMinAmtMax
0Not Qualifedcase             (9,999,999.00)                     528,300.00
1Membercase                  528,300.00                  1,584,900.00
2Court of the Tablecase               1,584,900.00                  3,169,800.00
3Top of the Tablecase               3,169,800.00          9,999,999,999.00
0Not QualifedAmount             (9,999,999.00)                  2,113,200.00
1MemberAmount               2,113,200.00                  6,339,600.00
2Court of the TableAmount               6,339,600.00                12,679,200.00
3Top of the TableAmount             12,679,200.00          9,999,999,999.00

 

CASE_REQ:
LOAD
[AmtMin] AS [CaseAmtMin],
[AmtMax] AS [CaseAmtMax],
[Level] AS [CaseLevel]
RESIDENT REQ
where Requirement ='Case'
;

SALES_REQ:
LOAD
[AmtMin] AS [SalesAmtMin],
[AmtMax] AS [SalesAmtMax],
[Level] AS [SalesLevel]
RESIDENT REQ
where Requirement ='Sales'
;

 

INNER JOIN IntervalMatch ( [# Total CASE] )
LOAD
[CaseAmtMin],
[CaseAmtMax]
Resident Case_REQ;

INNER JOIN IntervalMatch ( [# Total Sales] )
LOAD
[SalesAmtMin],
[SalesAmtMax]
Resident Sales_REQ;

 

It works but I just wondering whether it's the correct way to go.

Any other better solutions?  

1 Solution

Accepted Solutions
yipchunyu
Creator
Creator
Author

Find a pattern which can solve most of the issue as sth like below:

// Link Fields from raw with [# Total ] into the SALES_REQ ========
INNER JOIN INTERVALMATCH ([# Total])
LOAD
[AmtMin],
[AmtMax]
Resident SALES_REQ;

JOIN (raw) LOAD * RESIDENT SALES_REQ;
DROP TABLE SALES_REQ;
DROP FIELD [AmtMin], [AmtMax];

View solution in original post

1 Reply
yipchunyu
Creator
Creator
Author

Find a pattern which can solve most of the issue as sth like below:

// Link Fields from raw with [# Total ] into the SALES_REQ ========
INNER JOIN INTERVALMATCH ([# Total])
LOAD
[AmtMin],
[AmtMax]
Resident SALES_REQ;

JOIN (raw) LOAD * RESIDENT SALES_REQ;
DROP TABLE SALES_REQ;
DROP FIELD [AmtMin], [AmtMax];