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,
Solved! Go to Solution.
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 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(...
Here is the result using if(Count(....
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.