Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
This might be something very simple, but can't get it to work, don't know why.
I have if-else calculation and many more like the same in my script, when I am pulling the columns in a straight table (alongwith few other columns), what I observed is, qlikview won't show me the results from else part even though the condition is fulfilled for it.
For Ex:
if (isnull([Phase 2 ST_DT]), ((max([Phase 2 E_DT]) - [Actual C_DT])/30), ((max([Phase 2 E_DT]) - max([Phase 2 ST_DT]))/30)) as [2_Dur_shyamal]
It will show the value [2_Dur_shyamal] only when [Phase 2 ST_DT] is null, otherwise it will be blank.
On the other hand, if I am using these calculations individually as expressions, it works fine.
But I would like to have all these calculations done in script rather in expressions
Any ideas on this?
Hi,
Thanks for the reply. Can't share the actual app, so will create a sample app and share as soon as possible.
Hi,
Yes I am using a Group By clause.
Can you just put below in the script
((max([Phase 2 E_DT]) - max([Phase 2 ST_DT]))/30) as [2_Dur_shyamal]
Just for testing purpose, break the expressions into different columns like below:
[Phase 2 ST_DT],
((max([Phase 2 E_DT]) - [Actual C_DT])/30) as FirstPart,
((max([Phase 2 E_DT]) - max([Phase 2 ST_DT]))/30) as SecondPart
Hi,
Thanks for the reply.
I tried splitting up the column into 2 parts and it gives me values per the split expression.
But when I try using it with "If" condition it evalutes "Else" part incoreectly.
Can you please create a sample app. That will help you get your answer quick. For now, we all are guessing.
Hi Everyone,
I have created a sample app and to my surprise it works fine, exactly as I wanted except for the negative value (for Test4).
PFA the sample file.
Any suggestion why this would not work in a bigger scenario is really appreciated.
Hi Shyamal,
are the values in the sample file (I mean in the "problematic" column) the same as in the real environment?
Regards!
yes, I created exact replica of values in all the columns as in actual file.
Try this sample
if (len([Phase 2 ST_DT])<1, ((max([Phase 2 E_DT]) - [Actual C_DT])/30), ((max([Phase 2 E_DT]) - max([Phase 2 ST_DT]))/30)) as [2_Dur_shyamal]