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: 
brunolelli87
Creator II
Creator II

Calculating the number of days from a date

Hello guys,

I have two dataset. 
The first one contains some data like:

Table1:

CompanySerialNumber
CompanyATL-7458
CompanyARE-5874
CompanyBFD-9636
CompanyBAS-9871
CompanyCSV-9658
CompanyCSV-9657

 

The second one contains the SerialNumber and the DataManufatured

Table2:

SerialNumberDataManufactured
TL-745801/02/1987
RE-587405/12/1967
FD-963630/11/1992
AS-987129/04/1955
SV-965829/06/1968
TR-874703/03/2020
TR-874503/04/2020
TR-874403/05/2020
SV-965722/07/1952

 

As you can see on my example, I have much more items on Table2 then I have on Table1, and I would like to know how can I calculate the average number of days since manufactured for those items listed on Table1 only.

 

Something like this:
=avg(Today()-Date(DataManufactured))

 

So, in this case if the item is not on Table1, it should not be considered, no matter whether I have something selected or not.

How can I do that?

4 Replies
QFabian
Specialist III
Specialist III

Hi @brunolelli87 , i just copy and paste your data, and created the viz, and it works :QFabian_0-1618874528109.png

The only thing that i changed was the date format , because of the separator : / 

QFabian_1-1618874588609.png

And in dimensions, just check  to not show null values

QFabian_2-1618874662410.png

 

 

QFabian
brunolelli87
Creator II
Creator II
Author

@QFabian 

How can I create another expression in order to show the same average, but for those items that are on Table 2 and were not mentioned on Table1?

Thanks

brunolelli87
Creator II
Creator II
Author

Any ideas?

brunolelli87
Creator II
Creator II
Author

How can I create another expression in order to show the same average, but for those items that are on Table 2 and were not mentioned on Table1?

Thanks