Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
soniasweety
Master
Master

Exp not working

Hi all,

I am using below expression its showing ok but the result is not coming.

if(only({<JNum={">=$(=vStartDate)<=$(=vEndDate)"},

[RC]={'IN'},[Inl]={'Out'}>} [ID])=0,'Not',[ID])

but  if I use this  its working fine enough

only({<JNum={">=$(=vStartDate)<=$(=vEndDate)"},

[RC]={'IN'},[Inl]={'Out'}>} [ID]) 

if I  add the  IF condition its not working  what is the issue?

11 Replies
prma7799
Master III
Master III

I think you missed else part ..

soniasweety
Master
Master
Author

No,

ID is else part

its there  'Not',[ID])

prma7799
Master III
Master III

Then you should use here aggregate function

Try this..

if(only({<JNum={">=$(=vStartDate)<=$(=vEndDate)"},

[RC]={'IN'},[Inl]={'Out'}>} [ID])=0,'Not',Count([ID]))

soniasweety
Master
Master
Author

no PM.

it will give me the  1,1,1,1  like that  but I want to see that value    count it will not work

Anil_Babu_Samineni

Only returns only one values has been allocate else it will return Null. So, To over come this, Perhaps this may do job

if(Count(Aggr(only({<JNum={">=$(=vStartDate)<=$(=vEndDate)"},[RC]={'IN'},[Inl]={'Out'}>} [ID]), Field))=0,'Not',[ID])

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
soniasweety
Master
Master
Author

its not working anil,

Anil_Babu_Samineni

Yes, I know that . Where are you trying this? As i already stated it should not be Only. Can you explain your needed?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
soniasweety
Master
Master
Author

hmm,

I am using same exp in  kpi object its working

when its come to   straight table its not working.

Anil_Babu_Samineni

You have to cover all Dimension to aggregate functions like

if(Count(Aggr(only({<JNum={">=$(=vStartDate)<=$(=vEndDate)"},[RC]={'IN'},[Inl]={'Out'}>} [ID]), Dim1, Dim2, Dim3))=0,'Not',[ID])

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful