Showing posts with label Rolling dates. Show all posts
Showing posts with label Rolling dates. Show all posts

Saturday, 17 April 2021

How to calculate rolling dates using pySpark

Lets calculate current year minus 3 years data using pySpark 
  
You can achieve this using F.add_months(current_date(),-36) option
 












You also have the option to change the dates/year to start . In order to achieve this use F.trunc("end_date", "month") and F.trunc("end_date", "year")