Showing posts with label analysis. Show all posts
Showing posts with label analysis. Show all posts

Monday, March 19, 2012

Aggregations in Analysis Services STANDARD edition

I have fields in my cube where SUM is not a good aggregation (rate fields for example). I thought I should just set them to No aggregation, but it tells me that semi-additive aggregations are not available in Standard Edition (?). So, two questions...

1) How do I avoid representing these fields incorrectly in Standard Edition? What aggregation should they be set to? I don't want users to point Excel to them and get this big meaningless number!

2) How/Where do I produce Averages, etc? (I'm thinking that I can only do this in the Report or Excel - that it can't be done in the cube, is that right?)

Thanks for you help...

- Jim

You're correct that Standard Edition does not support semi-additive aggregations. These functions include ByAccount, AverageOfChildren, LastChild, FirstChild, LastNonEmpty, and FirstNonEmpty. If these are the right aggregations to use, you might be able to set up a calculated member that gives you something similar by going to the leaf level and then controlling the aggregation to the level your interested in. If you do this, make the measure you are "replacing" not visible to your users.

Regarding averages, store a SUM and a COUNT measure and do a ratio in a calculated member.

Good luck,
Bryan

|||

If you don't have enterprise edition, then this workaround might help:

http://solidqualitylearning.com/Blogs/dejan/archive/2006/11/08/3439.aspx

or

http://lorentsnv.spaces.live.com/blog/cns!235C78448ABCFC07!134.entry

Aggregation Utility

Reading the interesting document Microsoft SQL Server 2005 Analysis Services Performance Guide, I discover the existence of an Aggregation Utility.

Wher can I download it ?

What the name of the executable ... and where it is ?

Cosimo

It's called Aggregation Manager and you can download it here as part of the SQL 2005 samples:

http://www.microsoft.com/downloads/details.aspx?familyid=e719ecf7-9f46-4312-af89-6ad8702e4e6e&displaylang=en

HTH,

Chris

|||

We have an improved version of the Agg Manager incorporated into BIDSHelper too

www.codeplex.com/bidshelper

Sunday, March 11, 2012

Aggregation dependent on dimension attribute


Hi,

I have little tricky situation here and I'll try to describe it as accurately as possible...

Using Analysis Services 2005, I need to provide a measure in which the aggregation is basically a sum, but sometimes based on a maximum within a dimension member. Here's the situation:

Table: Event
Available fields: Event Group, Date, Attendance

Attendance is the measure and Event Group and Date (Time) are dimensions. Time has a Year - Month - Day hierarchy.

Event Groups have an attribute "Same Attendance" that signifies that the same people attended all events in that Event Group.

Example:
Event Group: "VB.Net Course" - Same Attendance = true
Related Events:
Nov 10, 2006 - Attendance = 12
Nov 20, 2006 - Attendance = 11
Dec 10, 2006 - Attendance = 10

Event Group: "SSAS Road Show" - Same Attendance = false
Related Events:
Nov 15, 2006 - Attendance = 40
Nov 25, 2006 - Attendance = 50
Dec 15, 2006 - Attendance = 60

What I need is:

Total attendance (Event Group - AllMember; Time - AllMember): 162 ( = max(Attendance) from VB.Net Course + sum(Attendance) from SSAS Road Show)
Attendance for Nov (Event Group - AllMember; Time - Nov): 102
Attendance for Dec (Event Group - AllMember; Time - Nov): 72
Attendance for Nov 20, 2006 (Event Group - AllMember; Time - Nov 10, 2006): 12

...so regardless what I select in the Time dimension, I always want it to count only Attendance = 12 for the Event Groups that have Same Attendance = true.

Please be as detailed as possible with your reply.

Thanks,
Sven

"...so regardless what I select in the Time dimension, I always want it to count only Attendance = 12 for the Event Groups that have Same Attendance = true" - but what happens when a time member outside the range of dates for that Event Group is selected? So, for Oct. 2006, would you count 12 or 0?|||

0

Good point. I should have said "to count a maximum Attendance of 12"...and yes, at least one of the Events of that Event Group must be in the selected period.

Sven

|||

I would probably use the attendance field from the database to create two physical measures. The [Sum Attendance] measure would use the Sum aggregate function and the [Max Attendance] function would use the Max aggregate function. Make those measures Visible=false. Then add a calc measure which would look something like this:

create member CurrentCube.[Measures].[Attendance]
as
([Event Group].[Same Attendance].[True],[Measures].[Max Attendance])
+ ([Event Group].[Same Attendance].[False],[Measures].[Sum Attendance]);

Will that work for you?

|||

Yes, it works....thanks.

I just have to add a little bit if [Same Attendance] is selected as a Dimension itself and drilled down into the individual members. That won't be a problem. Right now it still shows the Max + Sum when it should show only one or the other dependent on the CurrentMember.

|||

Sorry, I have to correct myself (again).

It is correct as long as you only look at the data by Event Group, which was all I needed so far, but as soon as you have multiple Event Groups with the [Same Attendance] = true, then it only takes the max of all of these. It would be nice to get the correct number across Event Groups.

I saw an approach with a recursive calculation that I may try to tweak to work here: Calculate for the Event Group first and then add the numbers up using the same function.

Sven

|||

I added the recursive calculation some time ago, but finally found a minute to post it here:

This is the new calculation: [Max Participants Per Event]:

IIF([Event].[Event Code].CurrentMember.Level IS [Event].[Event Code].[Event Code],

[Measures].[Max Attendance], *the one from furmangg's post

SUM(Descendants([Event].[Event Code].CurrentMember,[Event].[Event Code].[Event Code]), Measures.[Max Participants Per Event])

)

Then I take the max + sum as suggested.

Sven

Aggregation dependent on dimension attribute


Hi,

I have little tricky situation here and I'll try to describe it as accurately as possible...

Using Analysis Services 2005, I need to provide a measure in which the aggregation is basically a sum, but sometimes based on a maximum within a dimension member. Here's the situation:

Table: Event
Available fields: Event Group, Date, Attendance

Attendance is the measure and Event Group and Date (Time) are dimensions. Time has a Year - Month - Day hierarchy.

Event Groups have an attribute "Same Attendance" that signifies that the same people attended all events in that Event Group.

Example:
Event Group: "VB.Net Course" - Same Attendance = true
Related Events:
Nov 10, 2006 - Attendance = 12
Nov 20, 2006 - Attendance = 11
Dec 10, 2006 - Attendance = 10

Event Group: "SSAS Road Show" - Same Attendance = false
Related Events:
Nov 15, 2006 - Attendance = 40
Nov 25, 2006 - Attendance = 50
Dec 15, 2006 - Attendance = 60

What I need is:

Total attendance (Event Group - AllMember; Time - AllMember): 162 ( = max(Attendance) from VB.Net Course + sum(Attendance) from SSAS Road Show)
Attendance for Nov (Event Group - AllMember; Time - Nov): 102
Attendance for Dec (Event Group - AllMember; Time - Nov): 72
Attendance for Nov 20, 2006 (Event Group - AllMember; Time - Nov 10, 2006): 12

...so regardless what I select in the Time dimension, I always want it to count only Attendance = 12 for the Event Groups that have Same Attendance = true.

Please be as detailed as possible with your reply.

Thanks,
Sven

"...so regardless what I select in the Time dimension, I always want it to count only Attendance = 12 for the Event Groups that have Same Attendance = true" - but what happens when a time member outside the range of dates for that Event Group is selected? So, for Oct. 2006, would you count 12 or 0?|||

0

Good point. I should have said "to count a maximum Attendance of 12"...and yes, at least one of the Events of that Event Group must be in the selected period.

Sven

|||

I would probably use the attendance field from the database to create two physical measures. The [Sum Attendance] measure would use the Sum aggregate function and the [Max Attendance] function would use the Max aggregate function. Make those measures Visible=false. Then add a calc measure which would look something like this:

create member CurrentCube.[Measures].[Attendance]
as
([Event Group].[Same Attendance].[True],[Measures].[Max Attendance])
+ ([Event Group].[Same Attendance].[False],[Measures].[Sum Attendance]);

Will that work for you?

|||

Yes, it works....thanks.

I just have to add a little bit if [Same Attendance] is selected as a Dimension itself and drilled down into the individual members. That won't be a problem. Right now it still shows the Max + Sum when it should show only one or the other dependent on the CurrentMember.

|||

Sorry, I have to correct myself (again).

It is correct as long as you only look at the data by Event Group, which was all I needed so far, but as soon as you have multiple Event Groups with the [Same Attendance] = true, then it only takes the max of all of these. It would be nice to get the correct number across Event Groups.

I saw an approach with a recursive calculation that I may try to tweak to work here: Calculate for the Event Group first and then add the numbers up using the same function.

Sven

|||

I added the recursive calculation some time ago, but finally found a minute to post it here:

This is the new calculation: [Max Participants Per Event]:

IIF([Event].[Event Code].CurrentMember.Level IS [Event].[Event Code].[Event Code],

[Measures].[Max Attendance], *the one from furmangg's post

SUM(Descendants([Event].[Event Code].CurrentMember,[Event].[Event Code].[Event Code]), Measures.[Max Participants Per Event])

)

Then I take the max + sum as suggested.

Sven

Aggregating two dimension members

Hi to everybody!

First of all I'd like to apologize for my english!
...Then, this is the problem of a newbie of Sql Server Analysis Services, cubes and so on...,
I've created a cube, and I can easily browse it: what I wanted to obtain is a sort of Profit and Loss statement: dimensions are Revenues, Costs and periods, while "amount" is the only measure. It works!
But my question is: how can I aggregate two member of a same dimension? I.e.: how to create a new "row" in my cube where there are cost A plus cost B?
Does it make sense?

Thanks a lot

Jane Mischis

you can create a DIMENSION calculated member in the CALCULATIONS tab and have its parent hierarchy refer to COST hierarchy in the cost dimensions

in the expressions put

(<uniquename of cost A> + <uniquename of cost B>)

the new calcultion will appear as an additional row in the cost dimension.

hope this helps

|||Thank you so much for the answer..

Actually, what you suggest me is what I had done before writing here, but it didn't work, because:
- when I browse the cube, the new calculation does appear as an additional row in my members cost dimension, but it's transparent, like if it was hidden... and when I try to drag and drop it in row fields column on the right, I can't do it. I can just drop it above, in the filter box...

What's wrong?

Thank you,

Jane Mischis
|||

did you try doing it on a different browser (example Proclarity), cos the default browser that comes with analysis services can't perform all jobs.

|||No I didn't try, but I can't try, because I don't have it and I can't think I need it to solve my problem.
But I think the problem is elsewhere, maybe defining what dimensions and mesaures are.
The most important dimension is really "costs", but just the name of them, numbers come out from measure "amount"... And if I try to add a calculated Measures member, it works (i.e. "amount/1000")... but what I'd like to reach is just aggregate two names and having related sum i amounts.

Maybe I've to study a lot more...

Thank you however, Christina

Jane

|||Oh, great, I solve it.
I had just to put "all" in father member...

Thanks again

Jane

Thursday, March 8, 2012

Aggregate(field, scope) function against Analysis Services 2005

Hi folks,
I am trying to make use of a new feature that is supposed to be in
RS2005, AS2005 but Im not sure if it is really there.
The web page
<http://www.microsoft.com/sql/technologies/reporting/faq.mspx> mentions
that AS 2005 has "Report server support for server-calculated
aggregates".
Also the BOL documentation suggests that Aggregate supports aggregation
supplied by the data provider. I was led to hope that RS Aggregate
would somehow get the MDX aggregate of the scoped data.
When I tried I could not get it to work.
The following yields the correct number:
=Sum(Fields!YTDSales.Value, "table1_Group1")
The following parses OK but yields an empty cell:
=Aggregate(Fields!YTDSales.Value, "table1_Group1")
The reason I am doing this is to write generic reports that allow users
to select measures that may aggregate in different ways (e.g. Total
Cost and Margin%).Did you ever get a solution to this? I am having the same difficulty. I want
to use the power of Analysis Services to do the calculations and
aggregations. That way we can centralize the definition of all calculations
and the calculation script and just pull the results into whatever reports we
want.
"FatOaf" wrote:
> Hi folks,
> I am trying to make use of a new feature that is supposed to be in
> RS2005, AS2005 but Im not sure if it is really there.
> The web page
> <http://www.microsoft.com/sql/technologies/reporting/faq.mspx> mentions
> that AS 2005 has "Report server support for server-calculated
> aggregates".
> Also the BOL documentation suggests that Aggregate supports aggregation
> supplied by the data provider. I was led to hope that RS Aggregate
> would somehow get the MDX aggregate of the scoped data.
> When I tried I could not get it to work.
> The following yields the correct number:
> =Sum(Fields!YTDSales.Value, "table1_Group1")
> The following parses OK but yields an empty cell:
> =Aggregate(Fields!YTDSales.Value, "table1_Group1")
> The reason I am doing this is to write generic reports that allow users
> to select measures that may aggregate in different ways (e.g. Total
> Cost and Margin%).
>

Aggregate() function not working when a measure is not specified.

Hi,

I am new to Analysis Services, having used it for less than a month. I do apologise if this problem is the result of a stupid newbie mistake, but I could really use some help.

I am totally unable to get the Aggregate() function to work unless I specify the optional measure. I have build a cube from the Adventure Works DW database, based on the internet sales fact table and related tables. I used the wizard to design the hierarchy for the time dimension.

Both of the following queries fail with the same error message:

Query 1:

WITH MEMBER [Time Aggregate Test] AS 'Aggregate({[Ship Date].[Calendar Year - Calendar Semester - Calendar Quarter - English Month Name - Day Number Of Month].[Calendar Year].&[2002].&[2].&[3].&[7]:[Ship Date].[Calendar Year - Calendar Semester - Calendar Quarter - English Month Name - Day Number Of Month].[Calendar Year].&[2003].&[1].&[2].&[5]})'

SELECT [Time Aggregate Test] ON 0,{[Measures].[Sales Amount], [Measures].[Tax Amt]} ON 1

FROM [Adventure Works DW]

Query 2

WITH MEMBER [Aggregate Test]

AS 'Aggregate({[Dim Product].[English Product Name].&[Blade],[Dim Product].[English Product Name].&[Chain]})'

SELECT [Aggregate Test] ON 0,{[Measures].[Sales Amount], [Measures].[Tax Amt]} ON 1

FROM [Adventure Works DW]

The error message is: 'The Measures hierarchy already appears on the axis0 axis. It is very important for me to be able to show the aggregate members on columns and the measures on rows if at all possible. I have checked the AggregateFunction on both measures, and it is set to Sum, which is what I want. Again, I do apologise if this is a simple newbie mistake and I would be really grateful for any help.

Since in the WITH statement you didn't specify parent hierarchy, it assumed Measures. So you ended up with same hierarchy (Measures) being used both on columns and rows. To fix you can do this:

WITH MEMBER [Dim Product].[English Product Name].[Aggregate Test]

AS 'Aggregate({[Dim Product].[English Product Name].&[Blade],[Dim Product].[English Product Name].&[Chain]})'

SELECT [Aggregate Test] ON 0,{[Measures].[Sales Amount], [Measures].[Tax Amt]} ON 1

FROM [Adventure Works DW]

|||This works perfectly. Thank you very much for your help, Mosha. Your blog has made very useful reading, by the way.