Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

udaya_kumar
Valued Contributor

Calculating Share giving problem

Hi,

i have calculated share using the expression,

=sum(Volume) / sum(total<MONTH_NAME,MARKET_NAME> Volume)

the table shows the share for all the products in the market.

when i select some products, then share calculated among those selected products for a given month and given market.

i dont want it to calculate share among those products, i want share to be calculated for all the products.

ex;

Product Name
Share
Hum60%
Enb20%
Ste-
Sim20%

so if i unselect Enb from the product list, the share should show like this

Hum-60%

Sim-20%

Ste- -,

It should not show like this

Hum-70%

Sim-30%

Ste--

so how to change the expression, so that i will get like this

Hum-60%

Sim-20%

Ste- -,

Tags (1)
1 Solution

Accepted Solutions
udaya_kumar
Valued Contributor

Calculating Share giving problem

hi,

i used this expression

if(MetricName='NRx Share',

(Sum(Volume)/

aggr(NODISTINCT Sum({<PRODUCT_NAME=>} Volume),MONTH_NAME)))

it works fine

3 Replies
Not applicable

Re: Calculating Share giving problem

I think the expression should look something like this: sum(volume/sum(total {<product=>} volume). See example below. You should be able to add in the month if need be. I believe this logic is covered in "set modifiers" in the reference manual. You can set the value of product to be a specific value or to be all values, regardless of selections. Examples would be: sum(volume/sum(total {<product={'a'}>} volume) or the one above.
MVP
MVP

Calculating Share giving problem

Hi,

Can you attach sample file that you are working. 

Try calculating the Total and store it in variable and use this variable in expression like this.

your variable should be

vTotalValue = Sum({1} Volume)

So, now total is calculated, this value is used in expression like this

=sum(Volume)/vTotalValue

Now you will get the result as you expected.

Hope this helps you.

Regards,

Jagan.

udaya_kumar
Valued Contributor

Calculating Share giving problem

hi,

i used this expression

if(MetricName='NRx Share',

(Sum(Volume)/

aggr(NODISTINCT Sum({<PRODUCT_NAME=>} Volume),MONTH_NAME)))

it works fine

Community Browser