Quantcast
Channel: SQLServerCentral » Data Warehousing » Analysis Services » Latest topics
Viewing all articles
Browse latest Browse all 1341

ParallelPeriod using dynamic string

$
0
0
Hello there,I'm trying to make the below ParallelPeriod named set dynamic.This works fine:[code="sql"]WITH DYNAMIC SET [Test] AS StrToSet ( "ParallelPeriod([Finance Date].[Year-Week].[Week],1,[Finance Date].[Year-Week].[2013 Week 45])" )SELECT {[Test]} ON COLUMNSFROM [Cube];[/code]This produce an error of:[code="sql"]WITH DYNAMIC SET [Test] AS StrToSet ( "ParallelPeriod([Finance Date].[Year-Week].[Week],1,[Finance Date].[Year-Week].&[" + Cstr(datepart("yyyy",now())) + " Week " + Cstr(datepart("ww",now())) + "])" )SELECT {[Test]} ON COLUMNSFROM [Cube];[/code]Executing the query ...The '2013 Week 51' string cannot be converted to the date type.Execution completeObviously I need to somehow convert the string '2013 Week 51' in to a member value that SSAS will accept. Does anyone have any suggestions ?

Viewing all articles
Browse latest Browse all 1341

Trending Articles