Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
BI & Data Trends 2021. Discover the top 10 trends emerging in today. Join us on Dec. 8th REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Not applicable

Using Calculated Dimension for GetSelectedCount function

Hi Community,

I am trying to use GetSelectedCount to work for calculated dimension.

For example,

I can get it to work properly using dimension vDate,

however, if my filter is "=if(vDate>today()-14, vDate)", the GetSelectedCount will stop working. Is there anyway I can make it work?

I need it in order to prevent my table from going haywire as the expression I am using requires the vDate to be a particular value.

Regards,

MJ

5 Replies
Highlighted
Not applicable

Anyone can help? I can't find a satisfying answer on the community search. Thanks!

Highlighted
Specialist II
Specialist II

is it possible to post your application here?

Highlighted
Not applicable

Hi I am using a cloud version which I can't get it over here.

Essentally, the filter panel is using the dimension: "=if(vDate>today()-14, vDate)",


whenever I click any value, the filter displayed will be "if(vDate>today()-14, vDate)= MM/DD/YY"


resulting in GetSelectedCount(vDate) not working.


Therefore I am trying to see what are the ways to get it working other than making it a dimension in the load script.

Highlighted
Master
Master

I have run into a similar challenge.  I have a calculated Dimension that I created just to limit the number of years that are displayed in the filter and chart and want to ignore the values in my Set Analysis expression when they are selected.

It doesn't work. 

It would be nice if the new calculated dimension had a new field name that you could use. 

I don't think that you can get this to work as you are trying it.  The only thing that I can think of is to remove that expression from the Dimension if possible and calculate it somewhere else.  Then just reference that as the Dimension.  Then you are just using a single field or variable as the Dimension and it should work as expected.

Highlighted
Contributor
Contributor

I'm not sure if a later version added this functionality. However a similar issue has bugged me for a while.

 

You can put the calculated dimension into GetSelectedCount() as:

=GetSelectedCount("=if(vDate>today()-14, vDate)")

Or if you make if(vDate>today()-14, vDate) into a new dimension of vCalc then (double quotes in bold):

=GetSelectedCount($(=$(='''"=''&vCalc&''"''')))

I'm sure there's a nicer way without so much $ expansion, but I couldn't get that to work.