Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Aggr question - trying to calculate market totals

Hi,

I'm trying to calculate a market share for some products

MarketProductSoldMarket TotalMarket Share %
M1P110020050
M1P25020025
M1P35020025
M2P4207028,57142857
M2P5507071,42857143

Does anybody know if this is possible using the aggr() function? If so, how do I do this?

The "Sold" column is an easy expression like =Sum([Value]). the "Market Total" column should contain the total value of the entire market. I tried the =Sum(TOTAL [Value]) function, but this one returns off course 270 for every row. Next I tried =Aggr(Sum([Value]),[Market]) but that doesn't seem to do the trick

Any ideas?

1 Solution

Accepted Solutions
jerem1234
Specialist II
Specialist II

Try:

sum(total <Market> Value)

Hope this helps!

View solution in original post

7 Replies
nilesh_gangurde
Partner - Specialist
Partner - Specialist

Try this.

Aggr(Sum([Value]),Market,Product)

and for total

Aggr(Sum( Total [Value]),Market,Product)

-Nilesh

jerem1234
Specialist II
Specialist II

Try:

sum(total <Market> Value)

Hope this helps!

alexandros17
Partner - Champion III
Partner - Champion III

Your market share is

(Sold)/sum(MarketTotal)

Hope it helps

Not applicable
Author

that gives me this result:

MarketProductSoldMarket TotalMarket Share %
M1P110010050
M1P2505025
M1P3505025
M2P4202028,57142857
M2P5505071,42857143

I understand why, because this tries to aggregate the [Value] field per Market and Product dimension, which is basically the same as using the expression =Sum([Value]).

to add some more info: i'm only showing the Market and Product dimension in this table, but on my dashboard, there are several other dimension available for filtering purposes

jvishnuram
Partner - Creator III
Partner - Creator III

Hi Bart,

Aggr is just like a group by clause, it will give you the summing total based on Market only like adding all M1 and gives as 200 and adding all M2 and gives as 70 for all the relevant rows.

Not applicable
Author

thanks for the quick response! Never knew the expression could be so simple

maxgro
MVP
MVP

sum(Value) / sum(TOTAL <Market> Value)