Discussion board where members can get started with QlikView.
I'm sure this must be really straightforward, but I can't find a solution anywhere!
I have a field with lots of different values, and I want to use these values to create a new field, with only 3 values, in the script.
I want a new field called 'Description' that gives the value 'Freezing' if the Temp is = 0, 'Boiling' if the Temp is = 100, and 'Between' if the the Temp is neither 0 or 100.
if(Temperature=100,'Temp=100', 'Between')) as Temp
View solution in original post
Pick(Match(Temperature, 0, 100, Temperature), 'Freezing', 'Boiling', 'Between') as Description;
LOAD * Inline [
If(Temperature = 0 , 'Freezing',
IF(Temperature = 100, 'Boiling',
If(Temperature >0 AND Temperature < 100, 'Between'))) As Description;
Load * Inline [
I will advocate for using PICK() and MATCH() Function simply for load performance.
,PICK(MATCH(Temperature, 0 , 100 , Temperature),'Freezing','Boilong','Between') AS Description
LOAD * INLINE [
EDITED because I notice this same suggestion above
You may use the following script in order to take care of temperatures other than 0 and 100 correctly.
If(Temperature <= 0 , 'Freezing',
IF(Temperature >= 100, 'Boiling',
Thanks for everyone's responses.
This solution is perfect (I should have mentioned that the list of different temperatures was a lot longer than my example, so an inline table wouldn't work).