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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
mjperreault
Creator
Creator

Making Selections with Total Qualifier

Hi All,

I have data such as the below.

ContinentCountryMetric
North AmericaCanada400
North AmericaMexico100
North AmericaUSA200
South AmericaArgentina200
South AmericaBrazil300
South AmericaVenezuala300

 

On my sheet I have made made the below table with a Country's % of Continent measure with expression sum(Metric)/sum(Total <Continent>Metric) which yields the desired output. 

 
 

2020-09-03 15_45_30-Clipboard.png

However I want to be able to filter for an individual country and have the % stay the same while also filtering the other countries out of the table.

Currently if I filter on country the % changes to 100%

2020-09-03 15_46_14-Totals - My new sheet _ Sheets - Qlik Sense.png

If I update my formula to sum(Metric)/sum(Total <Continent>{<{Country}>}Metric) then the % is correct but the other Countries are not filtered out when I make my selection.  

2020-09-03 15_47_01-Inbox - MPerreault@waterfallam.com - Outlook.png

Does anyone have any ideas, I want to do this with a formula and not by adding a field in me data model that is the continents total value.

QVF attached

 

Thanks,
Mark

 

 

Labels (2)
1 Solution

Accepted Solutions
Kushal_Chawda
MVP
MVP

@mjperreault  try below

=sum(aggr(sum({<Country,Continent>}Metric)/sum(TOTAL<Continent>{<Country,Continent>}Metric),Country,Continent))*Avg(1)

View solution in original post

3 Replies
jwjackso
Specialist III
Specialist III

Try  sum(Metric)/sum({1}Total <Continent>Metric) and suppress zeroes on the chart.

mjperreault
Creator
Creator
Author

Thanks for the suggestion, that would yield this

2020-09-03 18_22_24-Clipboard.png


I do not want to remove the Continent total from the table.  Would prefer not to accomplish this with table settings as well but strictly using a formula but not sure if its possible.

 

Thanks,
Mark

Kushal_Chawda
MVP
MVP

@mjperreault  try below

=sum(aggr(sum({<Country,Continent>}Metric)/sum(TOTAL<Continent>{<Country,Continent>}Metric),Country,Continent))*Avg(1)