Year-on-year/Month-on-month Growth at the End of a Month/Year

<< Click to Display Table of Contents >>

Current:  Create Dashboard > Table > Visual Analysis > Year-on-year/ Month-on-month Growth 

Year-on-year/Month-on-month Growth at the End of a Month/Year

Previous pageReturn to chapter overviewNext page

After an industrial calendar is assigned, script control should be configured at the end of a month/year.  

The script is as follows:

table:

var mea = Table1.binding.getCol(0);

Table1.binding.setCol(0, mea);

mea.col.setEndDayType("1");

 

chart:

var mea3=Chart1.binding.getXCol(0);

Chart1.binding.setXCol(0,mea3);

mea3.col.col.setEndDayType("2")

setEndDayType :1 represents the end of a month; 2 presents the end of a year

 

text:

var mea = Text1.binding.getCol();

Text1.binding.setCol(mea);

mea.col.setEndDayType("1");

setEndDayType :1 represents the end of a month; 2 presents the end of a year

 

pivot:

var mea2=Pivot1.binding.getMeasure(0);

Pivot1.binding.setMeasure(0,mea2);

mea2.col.setEndDayType("1");

setEndDayType :1 represents the end of a month; 2 presents the end of a year

 

Note: 0 represents the end of month or year of column 0. "1" represents the end of month. "2" represents the end of year.

Note:Month-on-month calculation shall be carried out for the column at the end of year or month. And then prepare the script. Otherwise an error will be reported.

 

Application example

Set time base parameter at non-date column and calculate the month-on-month ratio at the end of month

1.Create /calendar/holidays.txt under the directory bihome. The contents are as follows:

weekend

2017-04-30

2017-05-01

 

2.Create a new table. Add a dimension column "分公司名称" and a  measure column: "Sum_当月股基交易量(两融)",as shown in the figure below.

My20

3.Select month-on-month from the submenu of column "Sum_当月股基交易量(两融)". Select "By Day" and "Growth Rate" at the month-on-month setting menu. Set m1=2017-02-07 in time basis parameter.

4.In the More menu of the dashboard`s menu bar, select Script to open the Dashboard Script dialog.

5.Script contents are prepared as follows.

var mea = Table1.binding.getCol(1);

Table1.binding.setCol(1, mea);

mea.col.setEndDayType("1");

My21

 

6.Re-open the Month-on-month dialog for the column "Sum_当月股基交易量(两融)", as shown in the figure below, and the time points for calculating the month-on-month ratio are 2017-02-28 and 2017-01-31. They are the month end of the current month and the month end of the previous month.

My22

7.In the menu, the user can set the period interval and origin point offset. Here we set the default value. The calculation result is shown in the figure below.

My23

 

8.According to actual requirements, the user can set the period interval and origin point offset at any time when defining the time basis parameters as shown in the figure below. Set fullday year-on-year ratio.

My24

 

Note: Month-on-month, year-on-year of year end, and month-on-month of month end are similar to the month-on-month of the month in the above month. Please refer to the above application example.