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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to filter data in qlikview by yeartodate function

I am unable to work with filtering data by using yeartodate function, Can any have any suggestion on the same?

1 Reply
villegasi03
Creator
Creator

I normally add a flag when I am loading my calendar or a table with dates you will want to look at year to date.

LET vDateToday = TODAY();

LOAD

    YOURDATE AS DATE,

    INYEARTODATE(YOURDATE, $(vDateToday), 0) * -1 AS YTD

FROM YOURCALENDARTABLE;

Now, when you want to use this in an expression you can use an IF statement or set analysis. For example.

IF(YTD = '1', SUM(SOMETHING))

OR

SUM({<YTD = {'1'}>}SOMETHING)