Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
New to Qlikview so please bear with me. As an example of what I'm after, say I have the following fields in my data:
On_Station
Off_Station
Change_Station
Passengers
Where there is an entry in Change_Station I want to use this field. If there isn't any data in that field I want to use On_station. I've tried:
if(Change_Station=''',On_Station,Change_Station) as BoardingStation
This only brings across the BoardingStation where data is in the Change_Station field. No doubt I'm making a basic mistake here but any help would be appreciated.
Thanks
Alex
Hi alexfinkel.
It seems right at first, although your quotes could be the result of a different encoding on your side.
And to make sure the field Change_Station is really empty, you could try this to check if it's empty or if it contains data.
The below code will obviosly give you a new field called BoardingStation containing either On_Station or Change_Station.
if(len(trim(Change_Station)) = 0, On_Station, Change_Station) as BoardingStation
Or this:
if(len(trim(Change_Station)) >= 1, Change_Station, On_Station) as BoardingStation
Or this:
if(trim(Change_Station) = '', On_Station, Change_Station) as BoardingStation
Kind regards
BI Architect Consultant
=if(Change_Station='',On_Station,Change_Station) .. you are using double quotes, it should be single quotes
Change_Station=''
Try
if( len(trim(Change_Station))=0,On_Station,Change_Station) as BoardingStation
Hi alexfinkel.
It seems right at first, although your quotes could be the result of a different encoding on your side.
And to make sure the field Change_Station is really empty, you could try this to check if it's empty or if it contains data.
The below code will obviosly give you a new field called BoardingStation containing either On_Station or Change_Station.
if(len(trim(Change_Station)) = 0, On_Station, Change_Station) as BoardingStation
Or this:
if(len(trim(Change_Station)) >= 1, Change_Station, On_Station) as BoardingStation
Or this:
if(trim(Change_Station) = '', On_Station, Change_Station) as BoardingStation
Kind regards
BI Architect Consultant
Thanks to all replies and the quick response.
The second method worked using the >=1
Thanks again.
Alex