IcCube - OLAP 时间维度,范围仅在开始日期链接

IcCube - OLAP Time Dimension with range only linked on start date

在 IcCube 中有一个时间向导,带有一个按范围索引的选项。然后我可以 link 这个维度到一个事实 table 有一个开始字段和一个结束字段。

但不幸的是,我有一个事实 table 只有开始日期,我想 link 以这种方式输入有效,直到我有另一个具有相同键的条目.这可能吗,还是我必须为每个条目添加结束日期?

如果我没理解错的话,你有一个事实 table 具有以下结构

 Dim1, DimTime, Amount
 1 , 1 Feb 2014, 2.4
 2 , 8 Feb 2014, 1.4     
 3 , 3 Feb 2014, 3.4

您想绑定 [2 月 1 日,2 月 3 日] 的第一行),[2 月 3 日,2 月 8 日] 的第三行等等。

如果是这种情况,没有简单的方法。理想情况下,您计算数据源中的 to) 部分,或者您可以使用 icCube 的 ETL 层在那里解决它(Javascript 带缓存)。请注意,对于非常大的 tables,最后一个不是一个好方法。

如果您可以按时间列排序,则算法会容易得多,而无需缓存整个 table。

您可以在此 link using a Javascript view as described here 中找到架构示例。

希望对您有所帮助

感谢您提供架构。不幸的是,我无法在 IcCube 中打开架构。它说,架构有问题。但是查看代码很有帮助。我稍微更改了 javascript,因为日期有问题,我添加了缓慢变化维度的可能性:

记忆中:

Dim1, DimTime, Amount
1,1 Feb 2014,2.4
1,3 Feb 2014,1.4
1,11 Feb 2014,1.4
2,4 Feb 2014,2.4
2,8 Feb 2014,1.4
3,3 Feb 2014,3.4
3,7 Feb 2014,6.4

初始化代码:

var SCD = "Dim1";
var formerRow = null;
var currentRow = null;
var rowNumber = 0;
var jDateType = Java.type( "org.joda.time.LocalDate" );
var jDateNow = new jDateType();

行处理行:

currentRow = copy();
set( currentRow, "TO", jDateNow );
if ( formerRow === null) {
  // first Line, copy the current row
  formerRow = copy(); 
  currentRow = null;
} else if (get(currentRow,SCD) != get(formerRow,SCD)) {
  set( formerRow, "TO", jDateNow );   
  fire(formerRow, rowNumber++);
  formerRow = currentRow;
  currentRow = null;
} else {
  // second  Line   
  set( formerRow, "TO", get(currentRow,"DimTime").plusDays(-1) );
  fire(formerRow, rowNumber++);
  formerRow = currentRow;
  currentRow = null;
}

完成代码:

fire( formerRow, rowNumber++ );