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

Announcements
We are aware of an issue with the Product Downloads page and looking into it.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

basic question

Hi all,

I have a basic question -- I'm trying to multiple a sum with a single value.

For instance:

-I have a table with multiple unit sales entrances per SKU

-Another table has a single value for the price of each SKU

Table A:

SKU A     4

SKU A     6

SKU A     10

Table B:

SKU A     $2.00

I'm trying to do (sum(table A))*(value(table B)), as the answer would be $40.00 for SKU A in this case.

How would I value up each SKU?

Cheers,

F.

Labels (1)
6 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Are you trying to do this in a chart or in the script?

-Rob

senpradip007
Specialist III
Specialist III

Which chart are you using or you do it in script?

Not applicable
Author

It's not a chart. So it's in the script, I suppose.

Not applicable
Author

It's not a chart. So it's in the script, I suppose.

MayilVahanan
MVP
MVP

HI,

     Try like this,

    

TableA:
Load * inline
[
Name1,Value
SKUA,4
SKUA,6
SKUA,10
];

join(TableA)
Load * Inline
[
Name1,Total
SKUA,2.00
];

TableB:
Load Name1,Total,Sum(Value) as TotalValue Resident TableA Group by Name1,Total;

TableC:
Load *,(TotalValue * Total) as ExpectedValue Resident TableB;

Drop tables TableA,TableB;

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
rlp
Creator
Creator

Instead of these 2 last loads, you can simply do:

Table_B :

Load

     Name1 ,

     Sum(Value) * Only(Total) as ExpectedValue

Resident TableA

Group by Name1 ;