Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Posting on Qlik Community is temporarily paused. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
stighy
Contributor
Contributor

Year to date : how to filter dates ?

Hi. I've a table : 

DatePrest; Group field; ... some fields...; Revenue

I'd like to show an Year To Date table like this: 

Group Field;  Current Year Revenue; Previous Year Revenue

Where i need to filter dates for:

Current year= 2023-01-01  to 2023-05-21 

Previous year= 2022-01-01 to 2022-05-21

How to write correct set analysis ? 
Thanks

Labels (1)
1 Solution

Accepted Solutions
rubenmarin
MVP
MVP

Hi, the expressions could be:

- Sum({<DatePrest={">=$(=YearStart(Max(DatePrest)))<=$(=Max(DatePrest))"}>} Revenue)

- Sum({<DatePrest={">=$(=YearStart(Max(DatePrest),-1))<=$(=AddYears(Max(DatePrest),-1))"}>} Revenue)

Maybe you need to add a Date() function to enclose the expressions inside $()

 

View solution in original post

1 Reply
rubenmarin
MVP
MVP

Hi, the expressions could be:

- Sum({<DatePrest={">=$(=YearStart(Max(DatePrest)))<=$(=Max(DatePrest))"}>} Revenue)

- Sum({<DatePrest={">=$(=YearStart(Max(DatePrest),-1))<=$(=AddYears(Max(DatePrest),-1))"}>} Revenue)

Maybe you need to add a Date() function to enclose the expressions inside $()