Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
paulyeo11
Master
Master

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
sunny_talwar

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

View solution in original post

9 Replies
sunny_talwar

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

rubenmarin

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
Master
Master
Author

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>

sunny_talwar

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
Master
Master
Author

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>

rubenmarin

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
Master
Master
Author

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>

sunny_talwar

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
Master
Master
Author

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>