I have a requirement in Wave Analytics where I need to fetch records from Previous year when current year is completed. I have a field named Processing Year. It now fetches 2017 records which we have hard coded. But when we move to 2019, it need to fetch 2018 records. I have tried lot of options but nothing seems to be worked out.

Something like Current Year-1 will work. Any help will be highly appreciated.

Thank you in advance

  • Have you gone through saql date functions
    – Reshma
    Dec 26, 2018 at 11:15
  • Hello Reshma...Yes I did but I didnt find required solution for the Issue. I tried it with ["previous year"..] it didnt work It worked only when Hardcoded as 2017. I need records of 2018 to be fetched when we enter 2019.
    – Sastri
    Dec 26, 2018 at 11:17
  • Can you please let me know how to get previous year records? Is it by using Previous year or last year? Nothing seems to work for me
    – Sastri
    Dec 26, 2018 at 11:55

1 Answer 1


Simply use 1 year ago as below. Assuming you will replace dataset and related date field name below:

q = load "Opportunity_SFDC";
q = filter q by date('CloseDate_Year', 'CloseDate_Month', 'CloseDate_Day') in ["1 year ago".."1 year ago"];
q = foreach q generate 'AccountId' as 'AccountId', 'CloseDate' as 'CloseDate',  'AccountId.Name' as 'AccountId.Name', 'Amount' as 'Amount', 'Probability' as 'Probability';
  • Thanks a ton Ayub. This one worked. Now I can able to retrieve 2017 records without hardcoding. I have a doubt here Will this pull all the 2018's records when the year moves to 2019 or only jan 2018's records as it is set to one year ago
    – Sastri
    Dec 26, 2018 at 12:44
  • Lets wait for Jan 2019...please keep posted in either cases....
    – Ayub
    Dec 26, 2018 at 13:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .