Quantcast
Channel: SQL Server Analysis Services forum
Viewing all articles
Browse latest Browse all 14337

CREATE RANGE SET using Now()

$
0
0

Hello,

I need to create set for last 10 days from last sunday.

I am able to create single values for last sunday and for last sunday minus 10 days

WITH SET [LastSunday] AS
StrToMember('[Calendar date].[Year - Quarter - Month - Date].[Date].&[' + Format(DateAdd("d",-10,DateAdd("d",-DatePart("w",Now()),Now())), "yyyy-MM-dd") + 'T00:00:00]')

SET [Last sunday minus 10 days] AS StrToMember('[Calendar date].[Year - Quarter - Month - Date].[Date].&[' + Format(DateAdd("d",-DatePart("w",Now()),Now()), "yyyy-MM-dd") + 'T00:00:00]')

It works fine, but how can I create SET with CREATE SET clause for range [LastSunday]:[Last sunday minus 10 days]

I have tried

CREATE SET [LastSunday] AS
StrToMember('[Calendar date].[Year - Quarter - Month - Date].[Date].&[' + Format(DateAdd("d",-10,DateAdd("d",-DatePart("w",Now()),Now())), "yyyy-MM-dd") + 'T00:00:00]:
[Calendar date].[Year - Quarter - Month - Date].[Date].&[' + Format(DateAdd("d",-DatePart("w",Now()),Now()), "yyyy-MM-dd") + 'T00:00:00]')

But it did not work.

Thanks


Viewing all articles
Browse latest Browse all 14337

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>