function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ravi sastriRavi sastri 

Fetch Previous Year's Records in Einstien Analytics

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
SandhyaSandhya (Salesforce Developers) 
Hi,

You can use below format
 
a = filter a by date('year', 'month', 'day') in ["1 year ago".."current year"];
a = filter a by date('year', 'month', 'day') in ["2 quarters ago".."2 quarters ahead"];
a = filter a by date('year', 'month', 'day') in ["4 months ago".."1 year ahead"];
a = filter a by date('year', 'month', 'day') in ["2 fiscal_years ago".."current day"];

Check below salesorce document for this.

https://developer.salesforce.com/docs/atlas.en-us.bi_dev_guide_saql.meta/bi_dev_guide_saql/bi_saql_functions_date.htm
 
Please mark it as solved if my reply was helpful. It will make it available for other as the proper solution.
                                             
Best Regards
Sandhya
 
Ravi sastriRavi sastri
Thanks a ton Sandhya. But 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.
Please help

Thank you in advance