Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Highlighted
qlikviewalex
New Contributor III

if condition in diagram

Hello,

in my diagram I use a formula:

=Count(if(Date#(endDate)=Date#(myDate), [Object-ID]))

This formula works.

Now I change my formula with <=:

=Count(   if(  Date#(endDate) <= Date#(myDate)   , [Object-ID]))

This formula doesn't works. Why?

My goal is a formula such as:

=Count(  if(  Date#(endDate)<=Date#(myDate)     and  Date#(startDate)>=Date#(myDate)   ,  [Object-ID]))

I hope someone can help me.

Alex

Tags (2)
1 Solution

Accepted Solutions

Re: if condition in diagram

Have you tried just this?

=Count(If(endDate <= myDate, [Object-ID]))

6 Replies
Not applicable

Re: if condition in diagram

I think it might be because Date#() function returns text instead of number, so Qlikview doesnt do < > calculation with it. Instead of Date#(), you may want to try Date().

MVP
MVP

Re: if condition in diagram

Date format. Yes that could be the reason. Could you post a sample qvw that demonstrates the issue?

qliksus
Valued Contributor II

Re: if condition in diagram

As said by tresesce data format could be a issue  change it to maybe something like this

=Count(   if(  Date(Date#(endDate,'MM/DD/YYYY'),'MM/DD/YYYY') <= Date(Date#(myDate,'MM/DD/YYYY'),'MM/DD/YYYY')   , [Object-ID]))

Re: if condition in diagram

Have you tried just this?

=Count(If(endDate <= myDate, [Object-ID]))

qlikviewalex
New Contributor III

Re: if condition in diagram

it was too easy

qlikviewalex
New Contributor III

Re: if condition in diagram

Thanks