Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

I want to use two fields from seperate tables. How would I do this?

Hi

I want to use two fields that are not in the same table. I have a field called 'E Date' in one table and 'A Date' that is in the other table. I need to deduct 'A Date' from 'E Date' to come up with the difference. How would I do this?

Many Thanks

Rajesh Bhardwaj

4 Replies
Not applicable
Author

Hi,

You can use the function Num, converting dates to num value like:

=num([E Date]) - num([A Date])

johnw
Champion III
Champion III

Assuming they're actual QlikView dates, you don't even need the num() function.

[E Date] - [A Date]

But that seems so simple that I have to assume you already tried it, Rajesh?

Is the problem that you want the difference stored in one of the two tables rather than calculated on the fly? Something else?

maneshkhottcpl
Partner - Creator III
Partner - Creator III

Hi,

If ur date in numeric formate like 20100101 then u have to seperate th eyear month and date and construct the date like

date(makedate(left(Date_1,4),mid(Date_1,5,2),right(Date_1,2)),'DD-MM-YYYY')

then deduct the both dates from each other.

Regards

Manesh

johnw
Champion III
Champion III


Manesh wrote:date(makedate(left(Date_1,4),mid(Date_1,5,2),right(Date_1,2)),'DD-MM-YYYY')


It's easier to use the date#() function, and the date() function will apply your default date format if none is specified. So:

date(date#(Date_1,'YYYYMMDD'))