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: 
Not applicable

Invalid dimension error in Table

Hi All,

I am using the following expression on one of my dimension in table, and it is throwing an error - Invalid dimension.

Formulae:

if(GetSelectedCount(COUNTRY) = 0,

   only({$<COUNTRY = {'England'}>}COUNTRY),

       COUNTRY)


Please correct me if anything implemented wrongly

Thanks in advance

1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

Try

=Aggr(If(GetSelectedCount(COUNTRY), COUNTRY, Only({<COUNTRY = {'England'}>} COUNTRY)), COUNTRY)

and check the dimension option 'Suppress when value is null'

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

View solution in original post

12 Replies
Chanty4u
MVP
MVP

did you chkd  country dimension values in listbox?

Not applicable
Author

Yes chanty.

I have England, USA and SEA as values in Country field.

If i use  if condition as below

if(Country = 'England',Country)   - Working fine, but restricting to England only.

My purpose is,

if I do not select any country by default it should show England and upon other selections it should the respective country details

Thanks

Chanty4u
MVP
MVP

try below

if(GetSelectedCount(COUNTRY) = 0,

   only({<COUNTRY = {'England'}>}COUNTRY),

       COUNTRY)

remove dollor

Not applicable
Author

Tried the same as well, but showing the same error.

Is there any other way (Logic) to achieve this .

Thanks for your quick response chanty

jonathandienst
Partner - Champion III
Partner - Champion III

Try

=Aggr(If(GetSelectedCount(COUNTRY), COUNTRY, Only({<COUNTRY = {'England'}>} COUNTRY)), COUNTRY)

and check the dimension option 'Suppress when value is null'

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

Vinay,

Try to add dimension as below:

if(GetSelectedCount(COUNTRY) = 0,'England',COUNTRY)


Same thing add in your expression also; Let say you want to do sum(xyz) then

if(GetSelectedCount(COUNTRY) = 0, sum({<COUNTRY={'England'}>}xyz) , sum(xyz) )

Hope this will resolve your problem!

Chanty4u
MVP
MVP

try wit Aggr

as jontathan

Aggr(if(GetSelectedCount(COUNTRY) = 0,

   only({<COUNTRY = {'England'}>}COUNTRY)),

       COUNTRY)

Not applicable
Author

Thank you so much jonathan  - its working.

Can I have a small background why its working with aggregation only??

thanks

Chanty4u
MVP
MVP

or else

=IF(GetSelectedCount(COUNTRY) = 0, COUNTRY, Aggr(

only({<COUNTRY = {'England'}>}COUNTRY)),

       COUNTRY))}>} COUNTRY), COUNTRY))