Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
IMPORTANT security patches for GeoAnalytics Server available to download: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

divide with 2 collumms/tables in 1

Hi guys,

can you tell me how can I divide with 2 tables ?

example:

Tab1:

Load DocNo,

     ArtNo,

     Cost, // here are amounts that costs with discount like: 550€ & -50€

     Quantity, //here are all quantity like 25 and 25

FROM ..

Now I want to sum(cost)/sum(quantity).

Is it possible to use it in script?

Backend in expressions, it works.

1 Solution

Accepted Solutions
anbu1984
Master III
Master III

You have to use group by

Load DocNo,

     ArtNo,

     sum(cost)/sum(quantity)

FROM ..

Group by //Include all columns other than cost and quantity

DocNo,ArtNo

View solution in original post

3 Replies
MayilVahanan

Hi

Try like this

Load DocNo, ArtNo, Cost, Quantity, Cost/Quantity As Percentage From ... ;

Thanks & Regards,
Mayil Vahanan R
anbu1984
Master III
Master III

You have to use group by

Load DocNo,

     ArtNo,

     sum(cost)/sum(quantity)

FROM ..

Group by //Include all columns other than cost and quantity

DocNo,ArtNo

MK_QSL
MVP
MVP

You can do as below

1)

Tab1:

Load DocNo,

     ArtNo,

     Cost,

     Quantity,

     Cost/Quantity as YourNewFieldName

FROM ..

2)

Tab2:

Load

     DocNo,

     ArtNo,

     SUM(Cost)/SUM(Quantity) as YourNewFieldName

Resident Tab1

Group By DocNo, ArtNo...

But the 1st Method is more efficient...