Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Using an aggregated value for all of the values of the same Aggr()

Hello!

Sorry for the confusing title, I think an example will makes things a little easier.

Let's say I have this table:

CustomerDaySales
A120
B230
C315
A425
B535

And now I add the  the aggreggation of the sum sales based on customer (syntaxis might be wrong, doing it from memory) aggr(sum(sales),Customer), that leaes me with the following table:

CustomerDaySalesAggr
A12045
B23065
C31515
A425-
B535-

So as you can see, when aggregating my table puts the value only in the first Customer it finds(or I don't know the logic behind), if I wanted to do something like a new column Sales/Aggr the output would be the following one:

CustomerDaySalesAggrRatio
A120450.44
B230650.46
C315151
A425--
B535--

So some columns won't calculated... Ideally what I would like is to have the aggregation of the sum repeated on each value 'Customer' that corresponds to.

Thank you!

1 Solution

Accepted Solutions
tresesco
MVP
MVP

You need a NODISTINCT within aggr(), like:

aggr( NODISTINCT sum(sales),Customer)

View solution in original post

4 Replies
PrashantSangle

Hi,

You are almost there just use sum() before your aggr()

like sum(aggr(sum(sales),Customer))

Regards,

Prashant

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
tresesco
MVP
MVP

You need a NODISTINCT within aggr(), like:

aggr( NODISTINCT sum(sales),Customer)

sunny_talwar

May be just this

Sum(TOTAL <Customer> Sales)

Check this out

Qlik Tips: No nodistinct

Not applicable
Author

This worked!

Thank you very much .