Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

set analysis: use complete dataset and 1 selection

I want to disregard all selections for this expression, except the city_id

The expression calculates the percentage of the population that has called the infocenter.

But the total population always has to be the total population, except when you select a city.

Then it has to be the total population of that city, not considering all the other selections that are made.

This is what I have, just disregarding all the selections:

count(DISTINCT inforequest_id)/count(total DISTINCT{1} inhabitant_id)

How do I add that the city_id has to be the selected city_id?

Hope someone can help!

Kind regards,

Katleen

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi,

Something like below,

count(DISTINCT inforequest_id)/If(GetSelectedCount(city_id)>0,  count(total DISTINCT inhabitant_id), count(total DISTINCT{1} inhabitant_id))

View solution in original post

10 Replies
Anonymous
Not applicable
Author

Hi,

Something like below,

count(DISTINCT inforequest_id)/If(GetSelectedCount(city_id)>0,  count(total DISTINCT inhabitant_id), count(total DISTINCT{1} inhabitant_id))

er_mohit
Master II
Master II

Try this

aggr((count(DISTINCT inforequest_id)/count(total DISTINCT{1} inhabitant_id)),city_id)

Not applicable
Author

Looks like it works, thanks!

Not applicable
Author

The issue that I have now is that when I select a month/quarter/.. the percentage goes over 100%

Anonymous
Not applicable
Author

Do you want month/quarter/.. selection to be ignored after city_id selection? If so, you may have to ignore them individually. Something like below,

count(DISTINCT inforequest_id)/count({$<month=, quarter=, ....>} DISTINCT total inhabitant_id)

Not applicable
Author

The original question is solved.

The issue that I have now is that when I select a month/quarter/.. the percentage goes over 100%

Anonymous
Not applicable
Author

Do you think you can provide your qvw with scrambled data. Without seeing application, it is difficult to understand the type of issue and give you correct resolution.

Not applicable
Author

I added a sample qvw

Anonymous
Not applicable
Author

Logic seems to be okay. I have selected project MIWA and Quarter Q1 and found inforequest_id=188 and NULL inhabitant_unit=139 which is 135,25%.

If you want to ignore quarter and month selection, you may use below expression,

count(DISTINCT inforequest_id)/NullCount(total{<inforequestQuarter=, inforequestMonth=>} inhabitant_until)

proj.JPG.jpg