Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

IntervalMatch with 2 intervals

Hello

I am having problems using the intervalmatch with 2 intervals and SAP. I have explorered the IntervalMatch (Extended Syntax) but it does not allow to intervals

[Facts]:

Load

[RACCT] as [Conta],

[KOSTL] as [CCusto],

[KSL] as [Value],

FROM

[..\..\DATOS\QVDATA\File.QVD] (qvd)

and i have a excel sheet that has the grouping configurations

[Config]:

LOAD * INLINE [

     Grupo1,     Grupo2,     AccountFrom,      AccountTo,     CostCenterFrom, CostCenterTo,

    Fabricacion Especialidades Tot, Fabricacion Especialidades, 62100000, 62109999, 1101, 1189

    Fabricacion Especialidades Tot, Fabricacion Especialidades, 62111000, 62111999, 1101, 1189

    Fabricacion Especialidades Tot, Fabricacion Especialidades, 62211000, 62215999, 1101, 1189

    Fabricacion Especialidades Tot, Fabricacion Especialidades, 62216000, 62217999, 1101, 1189

    Fabricacion Especialidades Tot, Fabricacion Especialidades, 62221000, 62999999, 1101, 1189

    Fabricacion Especialidades Tot, Fabricacion Especialidades, 64210000, 65128999, 1101, 1189

    Fabricacion Especialidades Tot, Fabricacion Especialidades, 68200000, 69999999, 1101, 1189

    Fabricacion Especialidades Tot, Fabricacion Especialidades, 73120000, 73120000, 1101, 1189

    Fabricacion Especialidades Tot, Fabricacion Especialidades, 62100000, 62109999, 9800, 9800

    Fabricacion Especialidades Tot, Fabricacion Especialidades, 62111000, 62111999, 9800, 9800

    Fabricacion Especialidades Tot, Fabricacion Especialidades, 62211000, 62215999, 9800, 9800

    Fabricacion Especialidades Tot, Fabricacion Especialidades, 62216000, 62217999, 9800, 9800

    Fabricacion Especialidades Tot, Fabricacion Especialidades, 62221000, 62999999, 9800, 9800

    Fabricacion Especialidades Tot, Fabricacion Especialidades, 64210000, 65128999, 9800, 9800

    Fabricacion Especialidades Tot, Fabricacion Especialidades, 68200000, 69999999, 9800, 9800

    Fabricacion Especialidades Tot, Fabricacion Especialidades, 73120000, 73120000, 9800, 9800

    Fabricacion Especialidades Tot, Costes Personal, 63111000, 63699999, 1101, 1189

];

I need to get the value of Grupo1, Grupo2  when ever  field [Conta] is between AccountFrom and AccountTo and field  [CCusto]  is between CostCenterFrom and CostCenterTo

3 Replies
Kushal_Chawda

try like below

Group_Map:

MAPPING LOAD

    AccountFrom+(iterNo()-1) as Key,

    Grupo1&'-'&Grupo2 as Group

From ConfigFile

WHILE iterNo() <= (AccountTo - AccountFrom) + 1;

[Facts]:

Load

[RACCT] as [Conta],

subfield(applyMap('Group_Map', [Conta], 'Other'),'-',1) as Group1,

subfield(applyMap('Group_Map', [Conta], 'Other'),'-',2) as Group2,

[KOSTL] as [CCusto],

[KSL] as [Value],

FROM

[..\..\DATOS\QVDATA\File.QVD] (qvd)

Not applicable
Author

Thank you for your reply

That solution only takes in consideration 1 of values Conta but i still need the Ccusto field

swuehl
MVP
MVP

You should be able to use something like this (there might be better solutions though):

[Facts]:

Load

[RACCT] as [Conta],

[KOSTL] as [CCusto],

[KSL] as [Value]

INLINE [

RACCT, KOSTL, KSL

62109888, 1150, 100

73120000, 1102, 200

63111002, 1180, 300

];

[Config]:

LOAD *, Recno() as ConfigID INLINE [

     Grupo1,     Grupo2,     AccountFrom,      AccountTo,     CostCenterFrom, CostCenterTo,

    Fabricacion Especialidades Tot, Fabricacion Especialidades, 62100000, 62109999, 1101, 1189

    Fabricacion Especialidades Tot, Fabricacion Especialidades, 62111000, 62111999, 1101, 1189

    Fabricacion Especialidades Tot, Fabricacion Especialidades, 62211000, 62215999, 1101, 1189

    Fabricacion Especialidades Tot, Fabricacion Especialidades, 62216000, 62217999, 1101, 1189

    Fabricacion Especialidades Tot, Fabricacion Especialidades, 62221000, 62999999, 1101, 1189

    Fabricacion Especialidades Tot, Fabricacion Especialidades, 64210000, 65128999, 1101, 1189

    Fabricacion Especialidades Tot, Fabricacion Especialidades, 68200000, 69999999, 1101, 1189

    Fabricacion Especialidades Tot, Fabricacion Especialidades, 73120000, 73120000, 1101, 1189

    Fabricacion Especialidades Tot, Fabricacion Especialidades, 62100000, 62109999, 9800, 9800

    Fabricacion Especialidades Tot, Fabricacion Especialidades, 62111000, 62111999, 9800, 9800

    Fabricacion Especialidades Tot, Fabricacion Especialidades, 62211000, 62215999, 9800, 9800

    Fabricacion Especialidades Tot, Fabricacion Especialidades, 62216000, 62217999, 9800, 9800

    Fabricacion Especialidades Tot, Fabricacion Especialidades, 62221000, 62999999, 9800, 9800

    Fabricacion Especialidades Tot, Fabricacion Especialidades, 64210000, 65128999, 9800, 9800

    Fabricacion Especialidades Tot, Fabricacion Especialidades, 68200000, 69999999, 9800, 9800

    Fabricacion Especialidades Tot, Fabricacion Especialidades, 73120000, 73120000, 9800, 9800

    Fabricacion Especialidades Tot, Costes Personal, 63111000, 63699999, 1101, 1189

];

Match:

IntervalMatch(Conta)

LOAD AccountFrom, AccountTo Resident Config;

Inner JOIN (Match)

LOAD  AccountFrom, AccountTo, ConfigID RESIDENT Config;

Left JOIN (Match)

LOAD DISTINCT Conta, CCusto RESIDENT Facts;

Inner JOIN (Match)

IntervalMatch(CCusto, ConfigID)

LOAD CostCenterFrom, CostCenterTo, ConfigID  Resident Config;

Left JOIN (Facts)

LOAD Conta, CCusto, ConfigID RESIDENT Match;

Left JOIN (Facts)

LOAD ConfigID, Grupo1, Grupo2 RESIDENT Config;

DROP TABLES Config, Match;