Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
desmond_mf_fung
Contributor
Contributor

Cannot count the specific year in a table

Hi All,

Currently, I have a file one column contains "channel" and one column contains "timestamp", the format is "DD/MM/YYYY  hh:mm:ss” and I set the loading timestamp  TimestampFormat='DD/MM/YYYY hh:mm:ss[.fff]';
Here I would like to count how many records I have per channel in year 2016/2017/last 12 months by channel in a table.

e.g.

Channel20162017
Axxxxxx
Bxxxxxx
Cxxxxxx
Dxxxxxx
Exxxxxx
Fxxxxxx

I had tried below expressions, but no luck to achieve. the number it should on 2016 column is exactly the same as 2017 column which is not correct.


First attempt:
2016: Count({$<"year(DATE(DATE#(mid([Timestamp I have],1,8), 'DD/MM/YY'), 'YYYY/MM/DD'))"}= {'2016'}>})[Timestamp I have])

2017: Count({$<"year(DATE(DATE#(mid([Timestamp I have],1,8), 'DD/MM/YY'), 'YYYY/MM/DD'))"}= {'2017'}>})[Timestamp I have])


Second attempt:
2016: Count(DISTINCT [Timestamp I have] & Year(Today()-2))

2017: Count(DISTINCT [Timestamp I have] & Year(Today()-1))


Third attempt:

2016: Count ( {1 <Year = {2016}> } [Timestamp I have])

2017: Count ( {1 <Year = {2017}> } [Timestamp I have])

Fourth attempt:

2016: Count({<[Timestamp I have]={'2016'}>} [Timestamp I have])
2017: Count({<[Timestamp I have]={'2017'}>} [Timestamp I have])


Please help.
Thanks.

Desmond

0 Replies