Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
amber2000
Creator
Creator

calculate amount out of total non selected

Hello boys and girls,

What I'm trying to do is show the amount of stores that are selected out of all the stores present.

There are 100 Stores and I've selected 20 of them so my result should be 20 / 100

This is my expression but the value on the left is the same as the value on the right:

=COUNT(Distinct(Store_ID)) & ' / ' & COUNT(Distinct(Store_ID))

Does anyone know how to fix this please?

Kind regards,

Monique

1 Solution

Accepted Solutions
adamdavi3s
Master
Master

I had thought you could use the inbuilt functions something like this:

=GetSelectedCount(Store_ID)&' / '&(GetSelectedCount(Store_ID)+GetNotSelectedCount(Store_ID))

But I am not sure GetNotSelectedCount works quite as I expected.

Vineeth's example is great but will only exclude Store_ID in the 'possible' number

You might want to use this to make sure the right hand number is regardless of any selections

COUNT(Distinct(Store_ID))  &' / ' & COUNT({1}Distinct(Store_ID))



Please remember to mark this as helpful or the correct answer if I have helped you or answered your question.

View solution in original post

15 Replies
vinieme12
Champion III
Champion III

=COUNT(Distinct(Store_ID))  &' / ' & COUNT({<Store_ID>}Distinct(Store_ID))

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
PrashantSangle

Hi,

Try below

1: COUNT(Distinct(Store_ID)) & ' / ' & COUNT(Total Store_ID)

2: COUNT(Distinct(Store_ID)) & ' / ' & COUNT({1}Store_ID)


Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
adamdavi3s
Master
Master

I had thought you could use the inbuilt functions something like this:

=GetSelectedCount(Store_ID)&' / '&(GetSelectedCount(Store_ID)+GetNotSelectedCount(Store_ID))

But I am not sure GetNotSelectedCount works quite as I expected.

Vineeth's example is great but will only exclude Store_ID in the 'possible' number

You might want to use this to make sure the right hand number is regardless of any selections

COUNT(Distinct(Store_ID))  &' / ' & COUNT({1}Distinct(Store_ID))



Please remember to mark this as helpful or the correct answer if I have helped you or answered your question.

CELAMBARASAN
Partner - Champion
Partner - Champion

Try this

GetSelectedCount(Store_ID) / Count(ALL Distinct Store_ID)

or

GetSelectedCount(Store_ID) / Count({1} Distinct Store_ID)


Both works same.

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try


=GetSelectedCount(Store_ID) & ' / ' & COUNT(Distinct Store_ID)

Hope this helps you.

Regards,

jagan.

Anonymous
Not applicable

For % of selected:

COUNT(Distinct(Store_ID)) & ' / ' & COUNT({1} Total Distinct(Store_ID))

For % of non selected

COUNT({1-$} Distinct(Store_ID)) & ' / ' & COUNT({1} Total Distinct(Store_ID))

Regards!

ToniKautto
Employee
Employee

Distinct is not a function, so there is no need for the brackets. The total number of store in your loaded data can be aggregated by using the ALL qualifier or a set expression that deselects all your selections.

COUNT( ALL DISTINCT Store_ID)

COUNT( {1} DISTINCT Store_ID)

The complete expression would then be: COUNT(DISTINCT Store_ID) & ' / ' & COUNT( ALL DISTINCT Store_ID)

ToniKautto
Employee
Employee

If a selection in an other field than Store_ID excludes a Store_ID, then this solution will not give all the Store_ID that was loaded into the data model.

ToniKautto
Employee
Employee

TOTAL is most likely not the accurate choice here, as it will only span over the values within the current selection. In a chart it would mean that the dimension is ignored and aggregation is done over the entire data set.

ALL is equal to the set expression {1}