Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

kalpanaramjee
New Contributor

Table

I need to replicate the attached table in qlikview

1 Reply
Highlighted
Sergey_Shuklin
Valued Contributor

Re: Table

Hello!

You'll have to do several data manipulations to achieve this. Take a look at this script:

start_tab:
LOAD * Inline
[
Company,	Product, 	Condition Met
ABC,	Bancassurance,	0
ABC,	BOL,	1
ABC,	Card and Diners NIR,	0
ABC,	Cash Deposit,	1
ABC,	Cashman,	0
ABC,	Commercial Property Finance,	0
ABC,	Current Account,	1
ABC,	Debtors Finance,	0
ABC,	Investments,	1
ABC,	Lending,	0
ABC,	Merchant,	1
];


prod_array_tab:
LOAD Concat(DISTINCT chr(39)&Company&'|'&Product&'|'&[Condition Met]&chr(39),',') as prod_array Resident start_tab;

LET vProd_array = Peek('prod_array',0,'prod_array_tab');

FOR Each vTab in $(vProd_array)
LET vTab_target = SubField('$(vTab)', '|',2);
Left Join(start_tab)
LOAD Company, Product, if(SubField('$(vTab)', '|',3) = 0, 0, [Condition Met]) as '$(vTab_target)' Resident start_tab;
NEXT

DROP Table prod_array_tab;

First of all you should get all values of Product field concatenated with companies and condition met.

After that FOR EACH will loop through possible Products and generate a table similar to the original table but with one additional condition - if we met zero in Condition Met field than all values of Condition Met should be equal zero.

Hope this solution wont hesitate you.