SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Named sets in SSAS


Named sets in SSAS

Author
Message
s_osborne2
s_osborne2
SSCommitted
SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)

Group: General Forum Members
Points: 1769 Visits: 2292
Hi,

I'm creating named sets in SSAS. I happen to be using 2012 but don't think that this has any effect on what i'm trying to achieve.

Essentially i have a named set that does a YTD calculation. The expression for that is here:

StrToSet("YTD([Effective Date].[Dates].[Date].[" + CStr(DATEPART("YYYY",NOW())) + "-" + Right("0" + CStr(DATEPART("m",NOW())),2) + "-" + Right("0" + CStr(DATEPART("d",NOW())),2) + "])")



This works great and show's me all the dates, 2013-01-01 to current day (2013-02-18). But this isn't what i really want (49 columns). What i want is a sum of the YTD. So instead of the attached (.png) I just want 1 column by 1 row sum total.

Is this possible or am i missing something?

Thanks,


Simon



MCSE: Data Platform
MCSE: Business Intelligence
Follow me on Twitter: @WazzTheBadger
LinkedIn Profile: Simon Osborne
Attachments
49cols.png (15 views, 8.00 KB)
Mackers
Mackers
Say Hey Kid
Say Hey Kid (683 reputation)Say Hey Kid (683 reputation)Say Hey Kid (683 reputation)Say Hey Kid (683 reputation)Say Hey Kid (683 reputation)Say Hey Kid (683 reputation)Say Hey Kid (683 reputation)Say Hey Kid (683 reputation)

Group: General Forum Members
Points: 683 Visits: 499
You either need to create a member such as below and report on that

create member [Effective Date].[Dates].[YTD] As

Aggregate(
StrToSet("YTD([Effective Date].[Dates].[Date].[" + CStr(DATEPART("YYYY",NOW())) + "-"
+ Right("0" + CStr(DATEPART("m",NOW())),2) + "-"
+ Right("0" + CStr(DATEPART("d",NOW())),2) + "])")
)

or create a YTD measure such as


create member [Measures].[YTD] As

Aggregate(
StrToSet("YTD([Effective Date].[Dates].[Date].[" + CStr(DATEPART("YYYY",NOW())) + "-"
+ Right("0" + CStr(DATEPART("m",NOW())),2) + "-"
+ Right("0" + CStr(DATEPART("d",NOW())),2) + "])")
, [Measures].[Revenue])

Mack
s_osborne2
s_osborne2
SSCommitted
SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)

Group: General Forum Members
Points: 1769 Visits: 2292
Hi,

Thanks for your reply.

So, in SSDT (Bids for 2012) on my calculations tab I don't want a named set to achieve what i'm after?

Sorry if my question seems dim, but i'm pretty new to this stuff.

Thanks,


Simon



MCSE: Data Platform
MCSE: Business Intelligence
Follow me on Twitter: @WazzTheBadger
LinkedIn Profile: Simon Osborne
Mackers
Mackers
Say Hey Kid
Say Hey Kid (683 reputation)Say Hey Kid (683 reputation)Say Hey Kid (683 reputation)Say Hey Kid (683 reputation)Say Hey Kid (683 reputation)Say Hey Kid (683 reputation)Say Hey Kid (683 reputation)Say Hey Kid (683 reputation)

Group: General Forum Members
Points: 683 Visits: 499
No, you don't just want a set

You have two real options here

Option 1 is creating measures such as Gross Revenue YTD, Net Revenue YTD etc (depending on the measure you have)

An example from one of my cubes is just to create lots of measures such as

CREATE MEMBER CURRENTCUBE.[Measures].[Net Revenue YTD]
AS
SUM(PERIODSTODATE([Date].[Date Hierarchy].[Year],[Date].[Date Hierarchy].CurrentMember)
,[Measures].[Net Revenue])

,FORMAT_STRING = "#,#.00"
,VISIBLE = 1;


The other slightly more complicated option is to create a dimension not linked to your data with you time calcs in it (query that just returns YTD, MTD etc)
You can then use a SCOPE statement to define the value of each member of the Time Calcs dimension such as


SCOPE ([Time Calcs].[Calc Name].&[YTD]);
THIS =
SUM(PERIODSTODATE([Date].[Date Hierarchy].[Year],[Date].[Date Hierarchy].CurrentMember)
,[Time Calcs].[Calc Name].[All] );

END SCOPE;


Option 2 probably needs more explaination (try http://www.bidn.com/blogs/Qazafi/ssas/1020/an-other-example-of-calculation-dimension) and I personally prefer option 1 anyway

Shout if I've lost you
Mack
s_osborne2
s_osborne2
SSCommitted
SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)

Group: General Forum Members
Points: 1769 Visits: 2292
Hi,

I'm sort of with you. It might help if I give a bit more context to what i'm doing....

I'm creating a cube to duplicate a pro clarity solution. Essentially i'm recreating the same thing but the client tool will now be excel and not pro clarity.

As i understand it in pro clarity there are named sets that have been created such as "YTD Current date" which today would give the sum value of their measures from 2013-01-01 to 2013-02-18. They could select any one of about 12 measures. So i've created the set as per my first post, which gives the output as per the screenshot. The thing is there is also a named set that's called "YTD Current date (previous year)" which would give the sum of the selected measure for the period 2012-01-01 to 2012-02-18 (the same period 12 months earlier). So using the named set i've created it's easy to use parallel period to go back one year. I can do that no problem.

My issue is with the output. Ideally all i wanted was a 1 row 1 column output but instead i get a no. of columns depending on the no. of days that have passed so far this year. I think pro clarity produces the 1 row 1 column output but can't confirm this until Friday.

So my options are the dimension with no relationships or calculating lots of measures....?

Thanks,


Simon



MCSE: Data Platform
MCSE: Business Intelligence
Follow me on Twitter: @WazzTheBadger
LinkedIn Profile: Simon Osborne
Mackers
Mackers
Say Hey Kid
Say Hey Kid (683 reputation)Say Hey Kid (683 reputation)Say Hey Kid (683 reputation)Say Hey Kid (683 reputation)Say Hey Kid (683 reputation)Say Hey Kid (683 reputation)Say Hey Kid (683 reputation)Say Hey Kid (683 reputation)

Group: General Forum Members
Points: 683 Visits: 499
Ahhh - ProCalrity won't be giving you one row but ProClarity does allow you to sum across a set if you put it in the background and combine items (this can lead to slow queries tho). However I don't think that you can do this in Excel so you will need to find another way of doing it

I, personally, would create YTD, Prior YTD measures unless the list of measures you have is huge

Mack
s_osborne2
s_osborne2
SSCommitted
SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)

Group: General Forum Members
Points: 1769 Visits: 2292
It's not huge, just inconvenient. I found out about the limitation of totalling and sets in Excel the other week. Frustrating to say the least.

Oh well, thanks for all your help. I'm just glad i seem to be understanding this stuff!

Thanks,


Simon



MCSE: Data Platform
MCSE: Business Intelligence
Follow me on Twitter: @WazzTheBadger
LinkedIn Profile: Simon Osborne
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search