6 Replies Latest reply: Sep 11, 2017 8:28 AM by ibrahibra aljefri

# Between function

hi qlikers

i want to use between function in qlik and my expresion as shown below :

sum(if(Floor(CreatedDate) = MakeDate(year(Today()),Month(Today())-1) and MakeDate(year(Today()),Month(Today())),1,0))

• ###### Re: Between function

Hi

1)which measure are going to sum ?(sales , patents ?

2)Are you looking for sum between  current month and previous month ?

• ###### Re: Between function

Give some more details

• ###### Re: Between function

Use variables in the qlik and use them in your SET expression to calculated the dates between

Ex:-

Let vFrDate =MakeDate(year(Today()),Month(Today())-1);

Let vToDate =MakeDate(year(Today()),Month(Today()));

Then use SUM expression to SUM your metric fields but need to check other field selections as well

=Sum({<DateField={">=\$(=vFrDate) <=\$(=vToDate)"} >} Value)

• ###### Re: Between function

Hi,

Try this,

In script make date field format like date(createdate,'DD-MM-YYYY') as createdate

in Expr:

Regards,

• ###### Re: Between function

If you are using this in the load script then try this ways

...

..

Sum(if( CreatedDate >= MakeDate(year(Today()),Month(Today())-1) and

CreatedDate <= MakeDate(year(Today()),Month(Today())),1,0))

From Source

...

...;

• ###### Re: Between function

i want to sum created for previous month and i am writing that code in expression as below :

sum(if(Floor(CreatedDate)>= MakeDate(year(Today()),Month(Today())-1) and Floor(CreatedDate)< MakeDate(year(Today()),Month(Today())),1,0))

actually it works but does not return the accurate number

note i am not trying to build it in script .