Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
stark___
Contributor III
Contributor III

Percent in pivot table

Hello,

Can you help me with my problem? I have a databaselike this:

StoreSupplierSales
(001) MYTTrade52 993
(001) MYTJohns31 731
(001) MYTSpring24 055
(001) MYTFreed36 722
(001) MYTSun25 179
(002) KOMTrade42 291
(002) KOMJohns52 873
(002) KOMSpring22 046
(002) KOMFreed36 465
(002) KOMSun28 927
(003) MARTrade59 557
(003) MARJohns65 533
(003) MARSpring24 670
(003) MARFreed42 320
(003) MARSun38 030

I want to get a pivot table, that will show me a percent of supplier's sales in every stores when I choose defined supplier.

I can create pivot table like this: (I use sum(Sales)/sum(total<Store>(Sales))

StoreSupplier%
(001) MYTFreed21,52%
Johns18,59%
Spring14,09%
Sun14,75%
Trade31,05%
(001) MYT Total 100,00%
(002) KOMFreed19,97%
Johns28,96%
Spring12,07%
Sun15,84%
Trade23,16%
(002) KOM Total 100,00%
(003) MARFreed18,39%
Johns28,48%
Spring10,72%
Sun16,53%
Trade25,88%
(003) MAR Total 100,00%

but I want to get table like this: (for example: I chose Trade)


StoreSupplier%
(001) MYTTrade31%
(002) KOMTrade23%
(003) MARTrade26%

Thanks for you help, Stark

1 Solution

Accepted Solutions
MayilVahanan

HI

Try like this

sum(Sales)/sum({1}total<Store>(Sales))

Please check the attached file..

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

2 Replies
MayilVahanan

HI

Try like this

sum(Sales)/sum({1}total<Store>(Sales))

Please check the attached file..

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
stark___
Contributor III
Contributor III
Author

Thank you, it works perfect. But I have more difficult case now: providers supply goods to stores in different categories:

StoreSupplierCategorySalesDate
(001) MYTFreedSoap8588,3301.06.2012
(001) MYTFreedShampoo3263,601.06.2012
(001) MYTFreedCream2959,3601.06.2012
(001) MYTTradeSoap6837,4101.06.2012
(001) MYTTradeShampoo10777,301.06.2012

and if I want to see a percent of supplier's sales of all categories in every stores, sum(Sales)/sum({1}total<Store>(Sales)) works perfect, but if I want to see a percent of supplier's sales of certain category, it shows me wrong  value. See attached file.