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

Comparing a date field with max of an unrelated date field

Helloooooooooo,

Basically i have two unrelated date fields and i would like to compare the two. So if ACCOUNT_OPEN_DATE <= max(TRADE_DATE) then i want count the number of clients.

//I would like to do something like this

count (distinct if( ACCOUNT_OPEN_DATE <= max(TRADE_DATE) , CLIENT))

When i do the above it doesnt show any data. Any Ideas??

Regards

Faisal

PS: CLIENT and ACCOUNT_OPEN_DATE fields are both in the same table but TRADE_DATE is in another unrelated table

1 Solution

Accepted Solutions
rajni_batra
Specialist
Specialist

PFA

Hope this could help u!!!

View solution in original post

9 Replies
rajni_batra
Specialist
Specialist

You cant't compare any two unrelated fields they must be linked withh each other through any primary key or any other linked key

Not applicable
Author

Okay so now i have linked the two tables using a TRADER_KEY. But it still doesnt work.

rajni_batra
Specialist
Specialist

Can u send the sample app

Not applicable
Author

Rajni,

Please find below the sample file.  The IF statement is in the guage chart. I hope you can come up with a solution

Regards

Faisal

rajni_batra
Specialist
Specialist

PFA

Hope this could help u!!!

Not applicable
Author

I think it works.. ill just check. Could you please tell me what this code in your guage chart means ?

{<DATE_OF_OPENING = {"<=$(=max(TRADE_DATE))"}>}

rajni_batra
Specialist
Specialist

equivalent to if condition when

date of opening <= max(trade date) then count

this is just in format of set nothing else

rajni_batra
Specialist
Specialist

you can also use

=Count(distinct if(DATE_OF_OPENING <=vmaxdate,CLIENT_CODE))

where vmaxdate= max(trade date)

Not applicable
Author

Thanks yo!!