Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikView forum consolidation is complete. Labels are now required. LEARN ABOUT LABELS
cancel
Showing results for 
Search instead for 
Did you mean: 
ozziqlik
Contributor
Contributor

Pie Chart selection

Hi All

Company asked me to build one of their old models into QlikView. They have a Doughnut Pie chart that shows the Sum(CreditAmount)

per Group. There are 3 groups (Group1, Group2, Other). The trick is that you can select from 2 dropdown boxes which Banks you want  to allocate to Group1 and Group2. Whatever was not selected in Group1 (Dropdown box 1) and Group2 (Dropdown box 2) will automatically fall under "Other". If you selected a Bank in Dropdown box 1 (Group1) it will not be available for selection in the Dropdown box 2 (Group2)

Any ideas??

5 Replies
ogautier62
Specialist II
Specialist II

Hi,

here is a way :

in the script, make a cross within banks to create fields group1 and group2 like this :

you'll replace Product of my example test with Bank

tmp:

load distinct Produit as group1 resident 'your table';

outer join (tmp) load group1 as group2  resident tmp ;

tmp2:

load *,1 resident tmp where group1 <> group2;

group:

load group1,group2,if(iterno()=1,group1,group2) as Produit    resident tmp2   while iterno()<=2 ;

so you can have two distincts selection boxes with group1 and 2

for the pie :
in dimension :
valuelist('1','2','others')
as expression :

if(valuelist('1','2','others')='1',sum(total {<Produit = P(group1) >} Prix),

   if(valuelist('1','2','others')='2',sum(total {<Produit = P(group2) >} Prix),

      sum(total {<Produit = E(group1), Produit= E(group2)>}   Prix)))

replace Prix with CreditAmount and Produit with Banks

and you can too add a text box to control a mistake where one bank could be in the two groups :

choices in error :

= concat(aggr( only({$<Produit = P(group1 ) * P(group2) >} Produit ) ,Produit),'//')

regards

ozziqlik
Contributor
Contributor

Hi Olivier

My Pie chart always shows 1 = 33.33% 2 = 33.33% and Other 33.33%.?

ogautier62
Specialist II
Specialist II

Hi Jay,

could you send some rows of data sample (xls) ?

and a sample of table group after creation in script ?

thanks

ozziqlik
Contributor
Contributor

How do I upload a .qvd file?

ogautier62
Specialist II
Specialist II

Uploading a Sample

Jay,

you must go on original discussion, not reply in inbox

(you won't see attach)