Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
ramrongala
Contributor II
Contributor II

how to skip some records based on condition in expression


Hi experts,

i have to skip the no of tickets(<0 and >40 days),below logic for
Formula= (visit start date -visit end date)

so if no of days below 0 and above 40 days need to skip those tickets.

entire logic should be = avg{<status code='Yes', Category= 'Sales',  (visit start date -visit end date)<0 and (visit start date -visit end date)>40>},Tickets)

but this columns coming from different source

2 Solutions

Accepted Solutions
MayilVahanan

Hi @ramrongala 

Try like this, create a day difference in script

Interval(visit end date-visit start date,'d')  as DayDiff

In Frontend,

avg{<status code={'Yes'}, Category= {'Sales'},DayDiff= {"<0 >40">}Tickets)

 

or

If(Interval(visit end date-visit start date,'d') <0 and Interval(visit end date-visit start date,'d')  > 40, 1, 0) as Flag

avg{<status code={'Yes'}, Category= {'Sales'},Flag= {1}>}Tickets)

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

PrashantSangle

I don't thinks so and clause will work. you should try with or clause.

 

modifying Mayil's solution

Interval(visit end date-visit start date,'d')  as DayDiff

In Frontend,

avg({<status code={'Yes'}, Category= {'Sales'},DayDiff={"<0"}> + <status code={'Yes'}, Category= {'Sales'},,DayDiff={">40"}>}Tickets)

or

If(Interval(visit end date-visit start date,'d') <0 or Interval(visit end date-visit start date,'d')  > 40, 1, 0) as Flag

avg{<status code={'Yes'}, Category= {'Sales'},Flag= {1}>}Tickets)

 

Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂

View solution in original post

4 Replies
MayilVahanan

Hi @ramrongala 

Try like this, create a day difference in script

Interval(visit end date-visit start date,'d')  as DayDiff

In Frontend,

avg{<status code={'Yes'}, Category= {'Sales'},DayDiff= {"<0 >40">}Tickets)

 

or

If(Interval(visit end date-visit start date,'d') <0 and Interval(visit end date-visit start date,'d')  > 40, 1, 0) as Flag

avg{<status code={'Yes'}, Category= {'Sales'},Flag= {1}>}Tickets)

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
PrashantSangle

I don't thinks so and clause will work. you should try with or clause.

 

modifying Mayil's solution

Interval(visit end date-visit start date,'d')  as DayDiff

In Frontend,

avg({<status code={'Yes'}, Category= {'Sales'},DayDiff={"<0"}> + <status code={'Yes'}, Category= {'Sales'},,DayDiff={">40"}>}Tickets)

or

If(Interval(visit end date-visit start date,'d') <0 or Interval(visit end date-visit start date,'d')  > 40, 1, 0) as Flag

avg{<status code={'Yes'}, Category= {'Sales'},Flag= {1}>}Tickets)

 

Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
ramrongala
Contributor II
Contributor II
Author

Thank you , its working.

 

ramrongala
Contributor II
Contributor II
Author

Thank you , its working.