Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

paulyeo11
Valued Contributor II

Sum(sales)/Rate vs Sum(sales/Rate) any different ?

H‌i All

CAn some one tell me above it is same ?

PAul

1 Solution

Accepted Solutions
MVP
MVP

Re: Sum(sales)/Rate vs Sum(sales/Rate) any different ?

Yes, the first one assumes that you will have one and only one Rate for your dimension, where as the second one doesn't bound itself with that condition and will do sales/Rate and then Sum it up

9 Replies
MVP
MVP

Re: Sum(sales)/Rate vs Sum(sales/Rate) any different ?

Yes, the first one assumes that you will have one and only one Rate for your dimension, where as the second one doesn't bound itself with that condition and will do sales/Rate and then Sum it up

Re: Sum(sales)/Rate vs Sum(sales/Rate) any different ?

Hi, if Rate has only one value in all cases... in maths it should be the same, but I think that in binary divisions with decimals can lead to sligthly different values.

paulyeo11
Valued Contributor II

Re: Sum(sales)/Rate vs Sum(sales/Rate) any different ?

Hi Sunny

Can you explain to me why sum(sales)/Rate cause memory full error ?

Paul Yeo

DIrector

TDS Technology (S) P/L

Whatsapp +65 9326 1804

www.tdstech.com<http://www.tdstech.com>

MVP
MVP

Re: Sum(sales)/Rate vs Sum(sales/Rate) any different ?

That I am not sure, but like I said, you might have more than one Rate for your dimension. Try to create a new expression like this

Concat(DISTINCT Rate, ', ')

and see if you only see one Rate or multiple rates, if you have multiple rates, then this isn't going to work... because Rate = Only(Rate) and will only display if you have one and only one value

paulyeo11
Valued Contributor II

Re: Sum(sales)/Rate vs Sum(sales/Rate) any different ?

Hi Sunny

I don't understand what you said ? I mean create the expression

Concat(DISTINCT Rate, ', ')

At where ?

Paul Yeo

DIrector

TDS Technology (S) P/L

Whatsapp +65 9326 1804

www.tdstech.com<http://www.tdstech.com>

Re: Sum(sales)/Rate vs Sum(sales/Rate) any different ?

Hi Paul, mainly it means that if Rate has more than one value it will return Null(), and "Sum(sales)/Null()" is Null().

If it has more than one value the expression needs to know what to do with the different values and if you do the aggretion outside the calculation will be different:

Sum(Sales)/Sum(Rate) //It will return something but not what you want

You can add Rate as dimension so there will be only one value for Rate for each dimension value

paulyeo11
Valued Contributor II

Re: Sum(sales)/Rate vs Sum(sales/Rate) any different ?

Hi All

Yes my Rate have few value , it depend SOURCE = SG or ID or MY ?

In QS custom report it will cause memory full error.

So I should use :-

Sum(sales)/Concat(DISTINCT Rate, ', ')

To avoid memory fill error ?

Paul Yeo

DIrector

TDS Technology (S) P/L

Whatsapp +65 9326 1804

www.tdstech.com<http://www.tdstech.com>

MVP
MVP

Re: Sum(sales)/Rate vs Sum(sales/Rate) any different ?

No, that won't help... that was just to test... but may be like this

Sum(sales)/Max(Rate)

or Min

Sum(sales)/Min(Rate)

or specific source

Sum(sales)/Only({<Source = {'SG'}>}Rate)

paulyeo11
Valued Contributor II

Re: Sum(sales)/Rate vs Sum(sales/Rate) any different ?

Hi Sunny

I just try with sum(sales/Rate) , it work fine. And no error.

When I use Sum( sales)/Rate it get memory full error.

Now i understand .

Thank you very much.

Paul Yeo

DIrector

TDS Technology (S) P/L

Whatsapp +65 9326 1804

www.tdstech.com<http://www.tdstech.com>

Community Browser