Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
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)
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)
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
May be this:
Sum(Sales)/Sum({TOTAL <Territory, Region = {'$(=getfieldselections(Region))'}>} Sales)
try like below.
sum(if(Territory = GetFieldSelections(Territory),Sales))/aggr(sum({<Territory>}Sales),Region)
Thanks guys for your help.