Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
surface3
Contributor
Contributor

Date range using variables in if statement

Hi

 

I am trying to use if statements to sum two different fields. My current expression is as below:-

 

=if((Var_Metric_View=1) and (Month3='>$(vMonth_Current)<=$(vEndDateFY19))',

sum(Headcount),


if((Var_Metric_View=2) and (Month3='>$(vMonth_Current)<=$(vEndDateFY19))',

Sum([Total FTE])))

 

What I want to achieve is if Var_Metric_View is 1 and the date field 'Month3' is between two dates, which are stored as variables, then sum headcount

OR

if Var_Metric_View is 2 and the date field is between the same two dates then sum FTE.

 

Any help A.S.A.P. would be much appreciated.

2 Solutions

Accepted Solutions
surface3
Contributor
Contributor
Author

Much appreciated.

 

Thank you!

View solution in original post

pradosh_thakur
Master II
Master II

@surface3  if your query is answered please close the thread else let us know.

Learning never stops.

View solution in original post

3 Replies
pradosh_thakur
Master II
Master II

=if($(Var_Metric_View )= 1  and Month3 >  $(vMonth_Current) and Month3 <=$(vEndDateFY19) ,

sum(Headcount),


if( $(Var_Metric_View)=2  and Month3 > $(vMonth_Current) and  Month3  <=$(vEndDateFY19),

Sum([Total FTE])
))
Learning never stops.
surface3
Contributor
Contributor
Author

Much appreciated.

 

Thank you!

pradosh_thakur
Master II
Master II

@surface3  if your query is answered please close the thread else let us know.

Learning never stops.