-1

We are reading the Google Analytics data using Cozyroc REST Source component in SSIS package. While reading the data, I can add the dateRange startDate and endDate in 'YYYY-MM-DD' format. Instead of adding static values, I wanted to read the data for 1st date to last date of previous month. As I see, there is nthdayago field. But how I can achieve the dateRange of previous month dynamically ?

Ajit Medhekar
  • 1,018
  • 1
  • 10
  • 39

2 Answers2

0

The only relative dates expressions are today, yesterday or NdaysAgo, so you have to create a custom formula in your system to go back to the length of the previous month.

Michele Pisani
  • 13,567
  • 3
  • 25
  • 42
0

Assuming you can take variables:

@LastMonth = dateadd("m",-1,getdate())
@LastMonthDay1 = (DT_DATE) ( (DT_WSTR,2)Month(@LastMonth) + "/1/"  + (DT_WSTR,4) year(@LastMonth)) 
@LastMonthLastDay = dateadd("d",-1,dateadd("m",1,@LastMonthDay1))
KeithL
  • 5,348
  • 3
  • 19
  • 25
  • I thought of same, but we are using Cozyroc component in SSIS package and we can pass those SSIS variables to the third-party component. – Ajit Medhekar Aug 18 '20 at 13:08
  • Why use that tool then? I almost exclusively use c# script task / component and WebClient – KeithL Aug 18 '20 at 14:01