Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
nicalbert
Partner - Contributor III
Partner - Contributor III

How to show data from last year in a table

Hello everyone,

I want to compare yesterday's data with data from the same date last year.

I'm using the following to get yesterday's data, and it works as expected:

=count({<[Call Date]={'>=$(=DayStart(today()-1))<$(=DayStart(today()))'}>} DISTINCT [Call Number])

I do however have problems getting the "same date last year" part to work. I have looked at many threads in this forum, and ended with this approach, which does not work:

=count({<[Call Date]={'>=$(=Date(Addyears(DayStart(today()-1),-1))<$(=Date(Addyears(DayStart(today()),-1))'}>} DISTINCT [Call Number])

Can someone give me help me with this?

Thanks,

Nic

1 Solution

Accepted Solutions
sunny_talwar

can you try this

=Count({<[Call Date] = {">=$(=DayStart(AddYears(Today()-1, -1)))<$(=DayStart(AddYears(Today(), -1)))"}>} DISTINCT [Call Number])

View solution in original post

9 Replies
sunny_talwar

Try this

=Count({<[Call Date] = {">=$(=DayStart(AddYears(Today()-1, -1))) < $(=DayStart(AddYears(Today(), -1)))"}>} DISTINCT [Call Number])
nicalbert
Partner - Contributor III
Partner - Contributor III
Author

Thank you! I just tried it, it does return a result, but the result is not accurate. But you've put me on the right track!

I looks as if it was capturing a year of worth of data (from a year ago until yesterday) instead of just "yesterday last year".

I tried moving the parenthesis around, but no luck (i either end up with 0 or a number representing the complete data)... 

 

sunny_talwar

can you try this

=Count({<[Call Date] = {">=$(=DayStart(AddYears(Today()-1, -1)))<$(=DayStart(AddYears(Today(), -1)))"}>} DISTINCT [Call Number])
nicalbert
Partner - Contributor III
Partner - Contributor III
Author

I tried, it gives the same result. And it seems to be the exact same expression (might be wrong!).

neelamsaroha157
Specialist II
Specialist II

=Count({$<[Call Date]={'$(=Date(Addyears(DayStart(today()))','$(=-1)))'}>}Distinct [Call Number])

nicalbert
Partner - Contributor III
Partner - Contributor III
Author


Thanks! This one returns 0...

sunny_talwar

Removed space before and after < in the set analysis

nicalbert
Partner - Contributor III
Partner - Contributor III
Author

Retried this morning, it worked right away!?!?!?!?!

thanks for you valuable help!

sunny_talwar

Awesome!!