Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

matthew_morge
New Contributor III

% Calculation

I am fairly new to Qlik Sense and looking for some help, I am currently struggling to calculate a % in a pivot or straight table.

I have a list of sales products as one dimension and country codes (origins) where those products are sourced from as the second dimension. The calculation itself works, if I select a single sales product the %'s truly reflect what the background data is suggesting. The issue I am having is when viewing the full list of products the %'s are being calculated across all parts and all origins.

In simple (excel) terms, I need to anchor the calculation to the sales product.

I have attached two excel files, with the Incorrect view and the Correct view.

My expression syntax is currently as follows:

SUM({$<COUNTRY_DB>}INVENTORY_QTY_ISSUED-INVENTORY_QTY_UNISSUED) / SUM(${<COUNTRY_DB>} Total (INVENTORY_QTY_ISSUED-INVENTORY_QTY_UNISSUED))

Any help (and brief explanation of where I am going wrong) would be gratefully received.

Many thanks,

Matt

5 Replies

Re: % Calculation

Try this

Sum({$<COUNTRY_DB>}INVENTORY_QTY_ISSUED-INVENTORY_QTY_UNISSUED) / Sum(${<COUNTRY_DB>} TOTAL <[Sales Part Description]> (INVENTORY_QTY_ISSUED-INVENTORY_QTY_UNISSUED))

matthew_morge
New Contributor III

Re: % Calculation

Thanks Sunny, I am sure I tried this or a variation of it, perhaps I got it wrong but I am glad to say that this has worked. It is stating that there is an error in the expressions but the figures check out so many thanks.

Much appreciated.

Matt

Re: % Calculation

May be error here

Sum({$<COUNTRY_DB>}INVENTORY_QTY_ISSUED-INVENTORY_QTY_UNISSUED) / Sum(${$<COUNTRY_DB>} TOTAL <[Sales Part Description]> (INVENTORY_QTY_ISSUED-INVENTORY_QTY_UNISSUED))

Life is so rich, and we need to respect to the life !!!

Re: % Calculation

Well spotted Anil

matthew_morge
New Contributor III

Re: % Calculation

Thank you both, works a treat.

Community Browser