Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
hossein61
Contributor
Contributor

Define a new field while loading data in QV using if statement

Hi

In my DB, I have "Price", "Flag1" and "Flag2" fields. I want to create a new field "Price2" while loading data in QV which contains Prices that meet following criterias:

Flag1>3 and Flag2=1.

In other words for a record: if Flag1>3 and Flag2=1, Price2 should be same as Price. Else, Price2 should be '0'.

How could I do this?

Hossein

Labels (1)
2 Replies
Mark_Little
Luminary
Luminary

HI ,

In you load script add a new line

IF( Flag1 > 3 and Flag2=1, Price,0) as Price2

Depend where you add the line you may need a comma at the end

MendyS
Partner - Creator III
Partner - Creator III

Hi @hossein61

used load inside load,

try this -

Table1:

*, if (Flag1>3 and Flag2=1), Price,0) as price2 ;

load .... from DB...;