Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
rbartley
Specialist II
Specialist II

Qlik Sense - Changing dimensions based on selections

Hello everyone,

I have a Qlik Sense app with a number of fields in the selection panel and a line chart.  The chart has two dimensions: the time dimension and the reference period, which allows me to compare prices over different years, with each year represented by a different line.  To prevent the lines showing averages, I have a calculation condition which forces the user to make a number of selections.  However, because of the number of dimensions and the length of the text, the legend is extremely long and so, I would like to be able to choose which fields appear in the legend, e.g. if(count(field a)>1,field a,if(count(field b)>1,field b,etc.....  However, when I try to implement this, it returns an invalid dimension. Does anyone know whether it is possible to change the field (not the value) based on the number of selections from a given field?

Thanks in advance,

Richard

1 Solution

Accepted Solutions
mdmukramali
Specialist III
Specialist III

Hi,

Can you have quick try with

GetPossibleCount()

View solution in original post

4 Replies
mdmukramali
Specialist III
Specialist III

Dear Richard,

can you Try GetSelectedCount function:

Can you try if(GetSelectedCount([field a])>=1,[field a],

                              if(GetSelectedCount([field b])>=1,[field b],  Etc


if it's not helpful then attach sample data file.


Thanks,

Mukram



                   

rbartley
Specialist II
Specialist II
Author

Dear Mohammed,

Thanks for your response.  I had already tried this but was hoping to avoid using GetSelectedCount since, as the user makes his selections,  it's possible that he will not make a selection from all fields, in which case, the number selected will be 0, but the count will be more than 1.  However, I see that GetSelectedCount does not lead to an invalid dimension message, so this might be the only way, along with a message telling the user to select at least one from each filter.

Here is the result using if(GetSelectedCount(...

Changing Dimension Based on Selection or Available Values- OK.PNG

Here is the result using if(Count(....

Changing Dimension Based on Selection or Available Values- NOK.PNG

Do you have any idea why using the same formula but just switching GetSelectedCount() for Count() would cause this behaviour.  Without further information, it looks like a bug to me.

mdmukramali
Specialist III
Specialist III

Hi,

Can you have quick try with

GetPossibleCount()

rbartley
Specialist II
Specialist II
Author

Hi Mohammed,

Yes, that works well, thanks.  Do you have any idea why simply using Count does not work?