Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I tried many times but it fails.
i have temperature data in which have a group of temperatures.
above -10 |
-10.1 to -13.9 |
-14 to -17.9 |
-18 & below |
i want group of this temp as
above -10 as 'A'
-10.1 to -13.9 as'B'
-14 to -17.9 as 'C'
-18 & below as 'D' in one field(BANDS) on UI.
such groups are different for different regions and branch_types but i have to put all in this A,B,C, D.
for example where Temperature locate in my database e.g -->sum({$<param_name={'Temperature'} ,region_name=>}param_value).
when i click on row of 'Temperature' in 'param_name' it will show the values in 'param_value' field.
How i have to put the condition in Script so that on UI when i click on A row of BANDS field, it will give me visualization for certain group
i have attached QVW.
Try adding this to the load statement for that table:
if(param_name = 'Temperature',
if(param_value <= -18, 'D',
if(param_value >= -17.9 and param_value <= 14 , 'C',
if(param_value >= -13.9 and param_value <= 10.1 , 'B',
if(param_value > -10, 'A'))))) AS BANDS
Note that your specification of the bands contains gaps. A value like -13.95 would not get a bands value.
Does the Case statement not work in Qlikview?
Not in a load statement. If you use it in an sql statement then it depends on the database that's going to execute it.
if(temp< -18
,'D'
,if(temp< -14
,'C'
,if(temp< -10.1
,'B'
,'A'
)
)
) as [Temperature Bands]
I have no idea what you're trying to calculate. But creating a BANDS dimension in the script using your specifications works just fine.