Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
n1ef5ng1
Creator
Creator

if statement on Dimension

     Hi ,

Say if I have a field name call Potato, inside the Potato, the data consist of 1,2,3,4

if i will to put this code on the Dimension

=if(Potato = '1',1','Others')

The output will be 1 and others(consist of 2,3,4)

however my expected output that I want is 1 and other(consist of 1,2,,3,4)

How do i do it

Thanks in advance

8 Replies
sivarajs
Specialist II
Specialist II

What you are trying is correct, its better use this expression in script and later use that field in your chart

jagan
Partner - Champion III
Partner - Champion III

Hi,

Just load a mapping table like this

LOAD *

INLINE [Potato, PotatoTemp

1, 1

2, Others

3, Others

4, Others];

Now use PotatoTemp as dimension, calculated dimension has impact on performance.

Hope this helps you,

Regards,

Jagan.

Not applicable

Hi,

could you please explain a bit more detailed, what you are trying to achieve?

I'm not clear which outpout for "other" you expect? In your post it seems to me that you want the whole range of "Potato" being displayed in  "other" ???

Greetings

Wiley_E

sushil353
Master II
Master II

your requirement is not clear,,

Please post some data and explain your issue with example.

HTH

Sushil

stabben23
Partner - Master
Partner - Master

Hi,

you should do this in script,

if(Potato=,1,'1', 'Other') as NewPotatoDimension

then use NewPotatoDimension as your dimensionfield.

jvitantonio
Specialist III
Specialist III

=IF(Potato='1', '1', IF(match(Potato, '1','2','3','4')>0, 'Others'))

n1ef5ng1
Creator
Creator
Author

Yes you are right, I want the 'others' to represent all in potato

Sent from my iPhone

n1ef5ng1
Creator
Creator
Author

Sorry, bad explanation from my side. The data in potato is non numeric

Sent from my iPhone