Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
Hi,
Something like below,
count(DISTINCT inforequest_id)/If(GetSelectedCount(city_id)>0, count(total DISTINCT inhabitant_id), count(total DISTINCT{1} inhabitant_id))
Hi,
Something like below,
count(DISTINCT inforequest_id)/If(GetSelectedCount(city_id)>0, count(total DISTINCT inhabitant_id), count(total DISTINCT{1} inhabitant_id))
Try this
aggr((count(DISTINCT inforequest_id)/count(total DISTINCT{1} inhabitant_id)),city_id)
Looks like it works, thanks!
The issue that I have now is that when I select a month/quarter/.. the percentage goes over 100%
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)
The original question is solved.
The issue that I have now is that when I select a month/quarter/.. the percentage goes over 100%
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.
I added a sample qvw
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)