Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
bharat19s
Contributor II
Contributor II

Store value in list & use them in Chart

Hi

I want to store some value like Apr-16, May-16...........Aug-17  in array/list & use this values in chart as dimension.

I tried this but not successed.

FOR t = YearStart(Today(),-1,4) to Today()

k = Date(MOnthStart(t),'MMM-YY')

t= AddMonths(t,1)

NEXT t;

1 Solution

Accepted Solutions
mdmukramali
Specialist III
Specialist III

Dear Bharat,

can you elaborate little bit more what you are trying to achieve?

if you are trying to store Month-Year in a field you can use master calendar and set the Minimum date and maximum dates in variables.

below is the code:

SET varMinDate=Date(YearStart(Today(),-1,4),'DD/MM/YYYY');
SET varMaxDate=Date(Today(),'DD/MM/YYYY');

TempCalendar: 
LOAD 
               $(varMinDate) + Iterno()-1 As Num, 
               Date($(varMinDate) + IterNo() - 1) as TempDate 
               AutoGenerate 1 While $(varMinDate) + IterNo() -1 <= $(varMaxDate); 
MasterCalendar: 
Load 
               TempDate AS OrderDate, 
               week(TempDate) As Week, 
               Year(TempDate) As Year, 
               Month(TempDate) As Month, 
               Day(TempDate) As Day,  
               date(monthstart(TempDate), 'MMM-YY') as MonthYear
Resident TempCalendar 
Order By TempDate ASC; 
Drop Table TempCalendar; 

Thanks,

Mukram.

View solution in original post

3 Replies
Anil_Babu_Samineni

Why you need only Apr-16 ... Aug-17 ?? Is there any logic?

May be this in script and use it dimension as this?

If(Match(FieldName, 'Apr-16', 'May-16', ......, 'Aug-17'), FieldName) as FieldName_Copy

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
mdmukramali
Specialist III
Specialist III

Dear Bharat,

can you elaborate little bit more what you are trying to achieve?

if you are trying to store Month-Year in a field you can use master calendar and set the Minimum date and maximum dates in variables.

below is the code:

SET varMinDate=Date(YearStart(Today(),-1,4),'DD/MM/YYYY');
SET varMaxDate=Date(Today(),'DD/MM/YYYY');

TempCalendar: 
LOAD 
               $(varMinDate) + Iterno()-1 As Num, 
               Date($(varMinDate) + IterNo() - 1) as TempDate 
               AutoGenerate 1 While $(varMinDate) + IterNo() -1 <= $(varMaxDate); 
MasterCalendar: 
Load 
               TempDate AS OrderDate, 
               week(TempDate) As Week, 
               Year(TempDate) As Year, 
               Month(TempDate) As Month, 
               Day(TempDate) As Day,  
               date(monthstart(TempDate), 'MMM-YY') as MonthYear
Resident TempCalendar 
Order By TempDate ASC; 
Drop Table TempCalendar; 

Thanks,

Mukram.

bharat19s
Contributor II
Contributor II
Author

@Anil Babu Samineni & @Mohammed Mukram

I have two dates Active customer date & Deactivate customer date, for the date range Apr-16 to Aug-17.

I have to show the count for both. But in Chart i can only take 1 date in dimension & Expression count of the respective conditions.

So I was thinking to generate a list of Dates (Apr-16 to Aug-17) as X- axis and 2 Y-axis showing count of each state by 2 different dates.