1

I have built a cube; and am not able to get the right results from it. Here is the issue I am facing.

I have a table in the DSV where I added a named calculated column. This column depends on two other columns: Customer ID and date. This calculated column must show the minimum date with respect to the customer. Here is the query I am using:

select customerID, min(date) mindate  from tableA where group by customerID

How do I build the query for the named calculation to get the minimum date of the customer?

customerID  mindate
656309  6/7/2013
10348   5/17/2013
687736  1/4/2013
130943  10/12/2012
657537  10/19/2012
428661  3/8/2013
9120    5/10/2013
5250    4/5/2013
681012  10/5/2012
37169   1/18/2013
4

1 回答 1

0

您可以尝试以下表达式

min(date) over(partition by customerID)

这在 DSV 的计算列中可能起作用,也可能不起作用。如果它不能用作计算列,则可以在命名查询中使用此表达式。为此,请右键单击 DSV 中的表,然后选择 Replace table/with named query。这显示了一个 SQL 选择语句。在此,您可以添加上面的表达式,它应该在任何情况下都可以工作。

于 2013-09-17T12:45:46.357 回答