Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
reinholdgraf
Creator
Creator

GetSelectedCount shows wrong value

Hi.

I have data per month-end (stock-values per article)

If I set a filter on the month-end (say 6 months) the following happens:

  • selected article has values in all 6 months, GetSelectedCount(Period) shows 6
  • selected article has values NOT in all 6 months (e.g. only in 2), GetSelectedCount(Period) shows 2.

In both cases, the active filter, shown in the headline of Qliksense shows correctly (6 of 51 filtered periods)

Am I doing something wrong or should I use a different formula ?

Based on the result of GetSelectedCount(Period), other figures such as average-consumption, days-of-inventory, etc. are calculated.

Regards,

Reinhold

1 Solution

Accepted Solutions
sunny_talwar

Not sure if I understand completely, but can you use this

Count(DISTINCT {1<Period = $::Period>} Period)

View solution in original post

12 Replies
rahulpawarb
Specialist III
Specialist III

Hello Reinhold,

Could you please share the application with sample data?

Regards!

Rahul

reinholdgraf
Creator
Creator
Author

I attached a sample-qvf where the situation is easily shown.

I also attach a screenshot showing the problem.

jonathandienst
Partner - Champion III
Partner - Champion III

I was surprised by your observation. I would expect GetPossibleValues() to respond to the number of possible months -- I would not have expected GetSelectedCount to respond as well.

However, if you have a Period list box open when you select that item, you will see that only 2 of the periods will be green-highlighted, so both the listbox and GetSelectedCount seems to only consider selections from the possible values only.

I think you will need to find another way to get that count.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
reinholdgraf
Creator
Creator
Author

Yes, that's right.

Both (GetSelectedCount and GetPossibleValues) respond 2.

sunny_talwar

Not sure if I understand completely, but can you use this

Count(DISTINCT {1<Period = $::Period>} Period)

reinholdgraf
Creator
Creator
Author

Could you kindly explain this formula as the result is ok now, but for some reason, other filters on the table (e.g. article) do not work anymore.

sunny_talwar

This specific expression ignores all selections except for selection in Period field. What exactly are you looking to get?

karthiksrqv
Partner - Creator II
Partner - Creator II

Hi,

Do you think it could be a version problem?

I opened your Test.qvf in my Qliksense Desktop 3.2 SR1 version and I see 1 in both (the built-in filter on top and the Getselectedcount)

reinholdgraf
Creator
Creator
Author

pls see attachement.

When using your formula, Filter set for Articles isn't working anymore and formula is only working for total table, not per row. But I need the formula-result per line as this is the basis for further calculations.

It seems, that we need a different approach as this is geeting complicated...