New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

cancel
Showing results for
Did you mean:
Contributor II

Comparing dates in an if statement

Hi! I need to compare 2 dates in order to count how many employees are at some time.

I have a pivot table with month and year as dimensions.

if(date(Fecha) >= date(leg_fecing,'MM/dd/yyyy'), Count(leg_numero)- Count (leg_fecegr))

It's not working. How can i solve this?

Labels (2)

• General Question

4 Replies
Specialist II

Hi @carotravaglini , please try something like this :

Count(if(num(Fecha)>=num(leg_fecing), leg_numero))

-

Count(if(num(Fecha)>=num(leg_fecegr), leg_fecegr))

QFabian
Contributor II
Author

Specialist II

Hi, checking your original formula, maybe it is like this:

Count(if(num(Fecha)>=num(leg_fecing), leg_numero))

-

Count(if(num(Fecha)>=num(leg_fecing), leg_fecegr))

QFabian
Contributor II
Author

Thank you @QFabian , i found a solution with this formula and your idea was really helpfull:

count(distinct(leg_numero)) - count(distinct(if([leg_fecegr.autoCalendar.Date]<[Fecha.autoCalendar.Date],leg_numero))) - count(distinct(if([leg_fecing.autoCalendar.Date]>[Fecha.autoCalendar.Date],leg_numero)))