Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Calculate Percent Contribution

Hi All,

I have a table with data for sales by territory, as shown below:

Region          Territory          Sales

Texas            Dallas               100

Texas            Houston            200

Texas            Austin               150

Illinois           Chicago            300

Illinois           Rockford           175

Illinois           Rosemont         230

I want to calculate the contribution of a selected territory I choose in a filter towards the total sales for the region the selected territory is a part of.

For eg: if I select Dallas in the filter then the result should show,

% Contribution=(100/450)*100 = 22.2%

Please suggest how can I achieve the current result.

Thanks.

1 Solution

Accepted Solutions
sunny_talwar

Is this in a kpi object? Try this

Sum(Sales)/Sum({<Territory, Region = p(Region)>} Sales)

For chart you can try this

Sum(Sales)/Sum(TOTAL <Region>{<Territory, Region = p(Region)>} Sales)

View solution in original post

6 Replies
sunny_talwar

Is this in a kpi object? Try this

Sum(Sales)/Sum({<Territory, Region = p(Region)>} Sales)

For chart you can try this

Sum(Sales)/Sum(TOTAL <Region>{<Territory, Region = p(Region)>} Sales)

pablolabbe
Luminary Alumni
Luminary Alumni

Don´t Forget !

When applicable please mark the appropriate replies as CORRECT https://community.qlik.com/docs/DOC-14806. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads as HELPFUL if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads as HELPFUL if you feel additional info is useful to others

balabhaskarqlik

May be this:

Sum(Sales)/Sum({TOTAL <Territory, Region = {'$(=getfieldselections(Region))'}>} Sales)

ChennaiahNallani
Creator III
Creator III

try like below.

sum(if(Territory = GetFieldSelections(Territory),Sales))/aggr(sum({<Territory>}Sales),Region)

Anonymous
Not applicable
Author

Thanks guys for your help.

sagar_1987
Contributor
Contributor

try like below. sum(if(Territory = GetFieldSelections(Territory),Sales))/aggr(sum({}Sales),Region)