1
我想返回從6月18日到昨天的一組日期。我嘗試如下,但我得到這個錯誤:從硬編碼起點到昨天的返回日期集
Executing the query ...
A calculated member cannot be used as an operand of the Range operator (:).
Execution complete
WITH
MEMBER [Date].[Date - Calendar Month].[LastDay] AS
Tail([Date].[Date - Calendar Month].[Calendar Day].members,1)
SET [Set_Dates] AS
{
[Date].[Date - Calendar Month].[Calendar Day].&[20130618]:
[Date].[Date - Calendar Month].[LastDay]
}
SELECT
NON EMPTY
[Set_Dates]
ON COLUMNS
FROM [myCube]
+1謝謝梅夫 - 我以前從未見過「STRTOMEMBER」在行動 - 像這樣。我想知道,如果':'右邊的所有內容都可以用null替換嗎? – whytheq
@whytheq如果你這樣做{[Date]。[SomeDate]:NULL}它將成爲從「某日期」直到日曆結束的日曆,無論何時。如果這就是你想要的,那就行了。 – Meff
...如果該立方體沒有爲昨天加載數據,那麼將STRTOMEMBER(「[Date]。[Full Date]。[」+ Format(DATEADD(「d」,-1,Now()),「yyyy- MM-dd「)+」]「,CONSTRAINED)'導致錯誤? – whytheq