Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

sum based on selection to new value. Loadscript

In the loadscript I load the following columns from table A.

ProductgroupProductgroup nameItemgroupItemgroup nameItem SKUItem Name

Sales amount

The output from that is

ProductgroupProductgroup nameItemgroupItemgroup nameItem SKUItem NameSales amount
10Bindemedel o bruk1001Cement002805618CEMENT STD PORTL 25KG1022,37
10Bindemedel o bruk1001Cement002843575BYGGCEMENT 40X25KG412,84
10Bindemedel o bruk1002Bruksbindemedel003491969NATURGIPS GYPSUM 40X25KG14968,77
10Bindemedel o bruk1005Torrbruk001339536GROVBETONG C30/37 25KG648,23
10Bindemedel o bruk1005Torrbruk001339537FINBETONG C30/37 25KG-95,53
10Bindemedel o bruk1005Torrbruk001339541MURBRUK B GULLEX M 2,5 40X25KG103,62
10Bindemedel o bruk1005Torrbruk002416539PUTSBRUK C BASE 135 HAND 25KG-2,55
10Bindemedel o bruk1005Torrbruk002931354EXPANDERBETONG EXM702 FIN 25KG1124,61
10Bindemedel o bruk1008Avjämningsmassa002416948SNABBSLIPSATS FLOOR318GROV 25-35,31
10Bindemedel o bruk1008Avjämningsmassa002416949SNABBSLIPSATS FLOO319 FIN 25KG-32,76

From this I want to (in the loadscript if possible)

sum the "sales amount" based on selection in "itemgroup"and give a new value.

Exampel:

Sum salesamount where Itemgroup ID = 1001 and 1002 to "indoor"

Sum salesamount where Itemgroup ID = 1005,1008 and 1008 to "outdoor"

1 Solution

Accepted Solutions
preminqlik
Specialist II
Specialist II

Load *,

if(match(Itemgroup,1001,1002),'INDOOR',if(match(Itemgroup,1005,1008),'OUTDOOR'))          as          NEWGROUP

from path;

View solution in original post

3 Replies
preminqlik
Specialist II
Specialist II

Load *,

if(match(Itemgroup,1001,1002),'INDOOR',if(match(Itemgroup,1005,1008),'OUTDOOR'))          as          NEWGROUP

from path;

Anonymous
Not applicable
Author

Hi Johan,

Is this what you are looking for?

Cheers,


Antoine

maxgro
MVP
MVP

just add a field as Prem Kumar suggested

and make the sum and all others calc in charts

LOAD Productgroup,

     [Productgroup name],

     Itemgroup,

     [Itemgroup name],

     [Item SKU],

     [Item Name],

     [Sales amount],

     pick(wildmatch(Itemgroup,1001,1002,1005,'*'), 'indoor', 'indoor', 'outdoor', '???') as NewField

FROM

[http://community.qlik.com/thread/118961]

(html, codepage is 1252, embedded labels, table is @2);