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: 
deerhunter
Creator
Creator

I need to eliminate all years from a table except the current year

/* The following does nothing, returns nothing  - Table [CurrentYearsData] never gets created*/

/* AllData has 20 years of data */

/* AllData [Fiscal Year] format is YYYY  -  IE: 2018 */

Let  vMaxDate = Year(Now());

CurrentYearsData:

Load
        *
Resident AllData

Where [Fiscal Year])= '$(vMaxDate)' ;

drop table AllData;

Labels (1)
3 Replies
Zhandos_Shotan
Partner - Creator II
Partner - Creator II

Hi!

Try the folowing changes:

1) Use = Year(Today());

2) Fix this:    Where [Fiscal Year])= '$(vMaxDate)' ;   

to Where [Fiscal Year]= vMaxDate;

 

deerhunter
Creator
Creator
Author

Hmmm, did not work?
Using:
Let vMaxDate = Year(Today());
Returns:
Field vMaxDate not found
Where [Fiscal Year= vMaxDate;
deerhunter
Creator
Creator
Author

/* The following does nothing, returns nothing - Table [CurrentYearsData] never gets created*/
/* AllData has 20 years of data */
/* AllData [Fiscal Year] format is YYYY - IE: 2018 */

Here is the code:
Let vMaxDate = Year(Today());
CurrentYearsData:
Load
*
Resident AllData
Where [Fiscal Year] = $(vMaxDate)

Any ideas?