Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

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
MVP
MVP

Re: Invalid dimension error in Table

Try

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

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

12 Replies
sureshqv
Esteemed Contributor III

Re: Invalid dimension error in Table

did you chkd  country dimension values in listbox?

Not applicable

Re: Invalid dimension error in Table

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

sureshqv
Esteemed Contributor III

Re: Invalid dimension error in Table

try below

if(GetSelectedCount(COUNTRY) = 0,

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

       COUNTRY)

remove dollor

Not applicable

Re: Invalid dimension error in Table

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

MVP
MVP

Re: Invalid dimension error in Table

Try

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

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

Not applicable

Re: Invalid dimension error in Table

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!

sureshqv
Esteemed Contributor III

Re: Invalid dimension error in Table

try wit Aggr

as jontathan

Aggr(if(GetSelectedCount(COUNTRY) = 0,

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

       COUNTRY)

Not applicable

Re: Invalid dimension error in Table

Thank you so much jonathan  - its working.

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

thanks

sureshqv
Esteemed Contributor III

Re: Invalid dimension error in Table

or else

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

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

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

Community Browser