Hi,
I am using SQL 2008R2, the Adventure Works database and I need to retrieve the first date with non-null Sales Amounts for each customer. The query is the following:
SELECT
{
[Measures].[Sales Amount]
} ON 0,
NONEMPTY
(
[Due Date].[Date Key].&[20010701]
:[Due Date].[Date Key].[All].LastChild
,{
[Measures].[Sales Amount]
}
).ITEM(0)
ON 1
FROM [Adventure Works]
WHERE
(
[Customer].[Full Name].&[11000]
)
While this correctly returns the first date in the specified interval with non-null sales amounts for customer 11000, I would need to achieve this for all customers and this is where I get stuck. So I need to incorporate the Customer dimension in the SELECT statement somehow and remove it from the WHERE clause.
Any help would be greatly appreciated!
Thank you!