Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
im using qlikview 8.5 In the edit expression, I have added this
OldBatteryPurchasePrice >0, (((amt + OldBatteryPurchasePrice)- Items_Dealerprice) / Items_Dealerprice ) * 100
and work prefectly, no issues............
but I have some condition
I have few rows, where oldbatterypurchaseprice row does not contain value, for that, I have to use different formula to calculate the profit
im trying the below if conditions, but it is not working... thanks
If( OldBatteryPurchasePrice >0, (((amt + OldBatteryPurchasePrice)- Items_Dealerprice) / Items_Dealerprice ) * 100 )
and
If(OldBatteryPurchasePrice=' ', ((amt - Items_Dealerprice) / Items_Dealerprice ) * 100 )
Try
len(trim(OldBatteryPurchasePrice)) = 0:
If( OldBatteryPurchasePrice >0,
(((amt + OldBatteryPurchasePrice)- Items_Dealerprice) / Items_Dealerprice ) * 100,
If( len(trim(OldBatteryPurchasePrice))=0, ((amt - Items_Dealerprice) / Items_Dealerprice ) * 100 )
)
In general, you can check your second condition in the else-branch of the first if()-statement:
If( OldBatteryPurchasePrice >0,
(((amt + OldBatteryPurchasePrice)- Items_Dealerprice) / Items_Dealerprice ) * 100,
If(OldBatteryPurchasePrice=' ', ((amt - Items_Dealerprice) / Items_Dealerprice ) * 100 )
)
Hope I have the gist of your issue.Not now familiar with v8.5, but on first sight I would say you are missing aggregation formula. Generally, but not always the aggregation should be outside the if statement so try;
sum(If( OldBatteryPurchasePrice >0, (((amt + OldBatteryPurchasePrice)- Items_Dealerprice) / Items_Dealerprice ) * 100 ),
If(OldBatteryPurchasePrice=' ', ((amt - Items_Dealerprice) / Items_Dealerprice ) * 100 )))
Note I have changed your statement to a nested if;
if(a =1,3,if(a=4,7))
the whole statement has been enclosed with a sum(xxxxxx) statement
Hope this helps
if statement is working, but
OldBatteryPurchasePrice=' ', i could not figure out, if there is no value in the row, should i use double single quotes or???
Try
len(trim(OldBatteryPurchasePrice)) = 0:
If( OldBatteryPurchasePrice >0,
(((amt + OldBatteryPurchasePrice)- Items_Dealerprice) / Items_Dealerprice ) * 100,
If( len(trim(OldBatteryPurchasePrice))=0, ((amt - Items_Dealerprice) / Items_Dealerprice ) * 100 )
)