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: 
Anonymous
Not applicable

How to set expression for field comparsion?

Hi All,

FromToDate
1/18/201612/12/20163/3/2016
2/14/20161/17/20171/1/2015
3/14/20164/1/20162/6//2016
4/19/20167/7/20177/7/2016

I would like to count the number of record where date > from  and date < to in the pivot table with dimension month(date)&year(date)

Many Thx!

Best Regards,

Louis

1 Solution

Accepted Solutions
sunny_talwar

This may not work if we have a single date associated with multiple From and To. I think creating this in the script might be a better option

LOAD If(Date > from_date and Date < To_date, 1, 0) as Flag,

           ....

and then use like this

Count({<Flag = {1}>} Measure)

View solution in original post

13 Replies
girirajsinh
Creator III
Creator III

try something

count( {<date={">=from_date<To_date"}>} fielda)

it would help to develop exact solution if you can share some sample data.

bR

Giri

MK_QSL
MVP
MVP

SUM(If(Date > From and Date < To,1,0))

or

SUM(Aggr(SUM(If(Date > From and Date < To,1,0)),Date,From,To))

vinieme12
Champion III
Champion III

TRY

=count( {<Date={"=Date > From and Date < To"}>} Date)

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
sunny_talwar

This may not work if we have a single date associated with multiple From and To. I think creating this in the script might be a better option

LOAD If(Date > from_date and Date < To_date, 1, 0) as Flag,

           ....

and then use like this

Count({<Flag = {1}>} Measure)

vinieme12
Champion III
Champion III

This work's sunny

Tested it

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
sunny_talwar

Even when date is associated with multiple From and To?

vinieme12
Champion III
Champion III

set_analysis_intra-record.qvw

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
sunny_talwar

Look at the attached example. Here I added three new rows and the column Record will tell you which rows are new.

Capture.PNG

vinieme12
Champion III
Champion III

Ok, then the only change you need to do is to verify with the Rowkey for the record which should be RowNum

you can try

=Count( {<RowNum={"=Date > From and Date < To"}>} Date)

Cheers

V

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.