Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Sv translation
languageja
Note

このセクションに進む前に、BellaDatiフォーミュラを十分参照することをお勧めします。

カレンダーの日付の代わりに、グラフのx軸に特定の出来事の日数を表示したい場合があるでしょう。

例えば、マーケティングのキャンペーンを2013-08-01から2013-10-01まで行うとき、以下を表示します:

  • 2013-08-01を「1日目」
  • 2012-08-02を「2日目」
  • 2013-10-01を「62日目」など

この使用例はデータセットのみに日付がある場合の方法を教えます。

変換スクリプトでデータを準備

データ内にcampaign_dayと命名された新規アトリビュトを作成し、以下のように変換スクリプトを適用します:

Code Block
int days= daysBetween(rowDate(), date('2013-08-01')) + 1;

String campaign_days = days.toString();

if(length(campaign_days) == 1) {
  return '0' + campaign_days;
}else {
  return campaign_days;
}

これにより、00から62までの形式でキャンペーン期間の日数を返却します。

フォーミュラの作成

レポートレベルでは、ドリルダウンとしてcampaign_dayを設定し、以下のようにインディケーターを計算します:

Code Block
dateInterval('2013-08-01', '2013-08-01' + ' + ' + memberValue() + 'd') { 
  crossValue('ALL_SMS_2_JOINED.ALL_SMS_2_JOINED', 'L_MSISDN_DCOUNT') 
}
Note

日付時刻機能を十分参照することをお勧めします。

Info

他所参照はドリルダウンを考慮しないことにご注意ください。累積値を計算できます。このようにして他所参照を魔法のように使用できるのです!

グラフでは次のような見た目になります:

ilupng
campaign_day

次に

Sv translation
languagede

 

Overriding Date Interval with Day Order [Original Seitentitel]

 

Note

Make sure to get familiar with BellaDati formulas before proceeding with this section.

 

There are cases that you want your chart x-axis to display number of days for a particular event, rather than the calendar date.

 

For example, if you are running a marketing campaign from 2013-08-01 to 2013-10-01, you want to display:

 

  • 2013-08-01 to be "Day 01"
  • 2012-08-02 to be "Day 02"
  • 2013-10-01 to be "Day 62" and so on.

 

This use case is going to show you how you could make it if you only have the date in your data set.

 

Preparing Data with Transformation script

 

Create a new attribute called campaign_day in the data set and apply transformation script as seen below:

 

Code Block
int days= daysBetween(rowDate(), date('2013-08-01')) + 1;

String campaign_days = days.toString();

if(length(campaign_days) == 1) {
  return '0' + campaign_days;
}else {
  return campaign_days;
}

 

This will return the number of days in terms of the campaign starting time in the format of 00 to 62.

 

Creating formula

 

At the report level, set the campaign_day as the drill down and calculate the indicator as seen below:

 

Code Block
dateInterval('2013-08-01', '2013-08-01' + ' + ' + memberValue() + 'd') { 
  crossValue('ALL_SMS_2_JOINED.ALL_SMS_2_JOINED', 'L_MSISDN_DCOUNT') 
}

 

Note

It is recommended that you get familiar with Datetime Functions.

 

Info

Remember that Cross Reference does not take drill down into consideration, so you are able to calculate the cumulated value. Here is how you use cross reference magically!

 

Here is how it looks like in the chart:

 

ilupng
campaign_day
 

Next Steps