Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Sebastian_Dec
Creator II
Creator II

Product shares in total per market

Hi, I have a problem, I want to calculate the sales value per store per product_range (sales shares).
Unfortunately, the current function counts shares per total sales, how to change it so that each store gives 100%?

My function:

 

 

 

 

Sum({<Product_range -={'Petrol station'} >} Sales)
/
Sum({<Product_range -={'Petrol station'} >} TOTAL Sales)

 

 

 

 

 

How I have:

Sebastian_Dec_0-1707466517049.png

How I want to have:

  Store_01 Store_02 Store_03
Total 100% 100% 100%
Bulk goods 43% 21% 86%
Fresh products 21% 29% 5%
Bazaar 11% 15% 3%
Services 21% 29% 5%
Bag 4% 6% 1%

 

Example data:

Product_range_Id Product_range Store Sales
1 Bulk goods Store_01 100
2 Fresh products Store_01 50
3 Bazaar Store_01 25
4 Services Store_01 50
5 Petrol station Store_01 100
6 Bag Store_01 10
1 Bulk goods Store_02 44
2 Fresh products Store_02 60
3 Bazaar Store_02 30
4 Services Store_02 60
5 Petrol station Store_02 120
6 Bag Store_02 12
1 Bulk goods Store_03 1231
2 Fresh products Store_03 72
3 Bazaar Store_03 36
4 Services Store_03 72
5 Petrol station Store_03 144
6 Bag Store_03 15

 

Thanks & Regards,
Please close the thread by marking correct answer & give likes if you like the post.
Labels (5)
2 Solutions

Accepted Solutions
LRuCelver
Partner - Creator III
Partner - Creator III

{<Product_range -= {'Petrol station'}>}
Sum(Sales)
/
Sum(total <Store> Sales)

 

View solution in original post

steeefan
Luminary
Luminary

Another possible solution using Aggr():

{<Product_range -={'Petrol station'} >} Sum(Sales) / Sum(Aggr(NODISTINCT Sum(Sales), Store))

 

View solution in original post

4 Replies
LRuCelver
Partner - Creator III
Partner - Creator III

{<Product_range -= {'Petrol station'}>}
Sum(Sales)
/
Sum(total <Store> Sales)

 

Sebastian_Dec
Creator II
Creator II
Author

Wow, Thank You LRuCelver!

Sebastian_Dec_0-1707468019445.png

 

full code:

Sum({<Product_range -= {'Petrol station'}>} Sales)
/
Sum({<Product_range -= {'Petrol station'}>} total <Store> Sales)

 

Thanks & Regards,
Please close the thread by marking correct answer & give likes if you like the post.
steeefan
Luminary
Luminary

Another possible solution using Aggr():

{<Product_range -={'Petrol station'} >} Sum(Sales) / Sum(Aggr(NODISTINCT Sum(Sales), Store))

 

Sebastian_Dec
Creator II
Creator II
Author

Hi, @steeefan , thank You, yes, its second good solution 🙂

Sebastian_Dec_1-1707469214879.png

Sum({<Product_range -={'Petrol station'} >} Sales) 
/
Sum(Aggr(NODISTINCT Sum({<Product_range -={'Petrol station'} >} Sales), Store))

 

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