Skip to main content
Announcements
The way to achieve your own success is the willingness to help somebody else. Go for it!
cancel
Showing results for 
Search instead for 
Did you mean: 
matthew_morge
Contributor III
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
sunny_talwar

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
Contributor III
Contributor III
Author

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

Anil_Babu_Samineni

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))

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
sunny_talwar

Well spotted Anil

matthew_morge
Contributor III
Contributor III
Author

Thank you both, works a treat.