Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
berryandcherry6
Creator II
Creator II

Getting min and max date of Date_Runrate

I am using below code to get Date_Runrate

LET vCalendarStart = Date#('01/01/2014'); 

LET vCalendarEnd = YearEnd(today()+5);

LET vCalendarLength = $(#vCalendarEnd) - $(#vCalendarStart) + 1;

Calendar1:

    LOAD

  Date($(#vCalendarStart) + RecNo()-1) AS "Date_Runrate"

AutoGenerate $(#vCalendarLength);

  

  Calendar2:

    LOAD

  Date_Runrate,

  Year(Date_Runrate) AS Year_Runrate,

  Num(Month(Date_Runrate), '00') AS Month_Runrate,

  month(weekend(Date_Runrate))& year(weekend(Date_Runrate)) as MonthPeriod_Runrate,

  Num(Day(Date_Runrate), '00') AS Day_Runrate,

  Num(Week(Date_Runrate), '00') AS Week_Runrate,

  weekday(Date_Runrate) as Names_of_day,

  date(weekend(Date_Runrate),'MM-YY') as MonthsPeriod_Runrate

    resident Calendar1;

  drop table Calendar1;

Now i need to find Min and Max of Date_Runrate where MonthPeriod_Runrate will be current month.

How could i do this.Please help me.

12 Replies
rubenmarin

Hi Supriya, you can obtain the min and max dates using a resident load with a formatted Today() date:

MaxMinDate:

LOAD Date(Min(Date_Runrate)) as Min_Date_Runrate,

  Date(Max(Date_Runrate)) as Max_Date_Runrate

Resident Calendar2 Where MonthsPeriod_Runrate=Text(Date(Today(), 'MM-YY'));

marcus_sommer

This result will be caused from the weekend() function within MonthPeriod_Runrate. I suggest you take a look here: Calendars and here: How to use - Master-Calendar and Date-Values where you will find many examples to master-calendars.

- Marcus

berryandcherry6
Creator II
Creator II
Author

Hi rubenmarin  ,

Thanks,This is what i was looking for.

Regards,

Supriya Gangaiah