# New to QlikView

If you’re new to QlikView, start with this Discussion Board and get up-to-speed quickly.

Announcements
Talk to Experts Tuesday, January 26th at 10AM EST: Qlik Sense. REGISTER NOW
cancel
Showing results for
Did you mean:
Creator III

## Multiple Cost by Kg shows incorrect Value

Hi

I have a table of cost by kg, for multiple types of cost. There are costs for each combination of: Year,Product Group, Real Product and Package Type.

I also have a table of products, and each product has multiple cost by kg related.

I need to calculate the cost by kg for each product, and it's associated dimensions (Such as real product, rotulated product...), but I'm getting incorrect values when I use dimensions that are not the "keys" dimensions of the costs. (Year,Product Group, Real Product and Package Type.)

I've uploaded an example with the data and the expression that I am using.

How should I calculate the cost by Kg?

Thanks!!

1 Solution

Accepted Solutions
MVP

May be you need this

=Sum([Cost by Kg] * Kg)/Sum(Kg)

4 Replies
MVP

May be you need this

=Sum([Cost by Kg] * Kg)/Sum(Kg)

Creator III

Thanks!

Dumb of me..

I've tryied with a similar expression:

Sum([Cost by Kg])*Sum(Kg)

But with incorrect values. Could you pleas explain to me what is the difference with the following:

Sum([Cost by Kg] * Kg)

I ask, because in many cases both expression gave me the same values.

Thanks Sunny

MVP

Expression 1 will Sum Cost by Kg based on your dimension and then multiply it with Sum of Kg. Second expression will first multiply Cost by Kg and Kg per row and then sum it for each of your dimension.

Does that make sense?

Creator III

Yes, a lot of sense. Thanks!

Tags