New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
BI & Data Trends 2021. Discover the top 10 trends emerging in today. Join us on Dec. 8th REGISTER
cancel
Showing results for
Did you mean:
Highlighted
Contributor II

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
Highlighted
MVP

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)

6 Replies
Highlighted
MVP

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)

Highlighted
Luminary

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

Highlighted
Master

May be this:

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

Highlighted
Creator III

try like below.

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

Highlighted
Contributor II