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,
maybe the problem relies in the IsNull(field) function. I suggest you to use len(trim(field))=0 instead of IsNul:
if (len(trim([Phase 2 ST_DT]))=0, ((max([Phase 2 E_DT]) - [Actual C_DT])/30), ((max([Phase 2 E_DT]) - max([Phase 2 ST_DT]))/30)) as[2_Dur_shyamal]
Hope this helps!
Hi,
Thanks for the response.
I tried the same, but doesn't work.
Hi,
what if we change the conditions order:
if (len(trim([Phase 2 ST_DT]))>0, ((max([Phase 2 E_DT]) - max([Phase 2 ST_DT]))/30 , ((max([Phase 2 E_DT]) - [Actual C_DT])/30))) as [2_Dur_shyamal]
Hi,
In that case it calculates the else part, so no matter what order I keep, it always seems to display the expression for the condition :
[Phase 2 ST_DT] = 0
Which values have you got in that field [Phase 2 ST_DT] ?
Syamal actually while there is dimension in the chart or graph you are using hense use this condition as
if(sum([2ST_DT])<>0,(max([2E_DT])-max([2ST_DT]))
,max([2E_DT])-max(C_DT))
See the sample i have pasted.
check for synax as per following expr
fabs(SUM({<FinancialYear=,Quarter=,MonthName=>} AGGR(if((Date(vDateForAgeing)-if(isnull(Date([DUE_DATE])),1,Date([DUE_DATE])) >=181),SUM({$<FinancialYear=,Quarter=,MonthName=,[Posting Date] ={"<=$(=MonthEnd(Max([Posting Date])))"}>}[Net Outstanding])),DOC_NO,Customer,Location))
/100000)
HTW
Vikas
There are numeric values.
Hi,
Thanks for your response.
But it's working fine when I am using them in expressions.
My problem is, I want to do all these calculations in script where it is causing issue.