Showing posts with label cube. Show all posts
Showing posts with label cube. Show all posts

Sunday, March 25, 2012

creating a time dimension

this is my first cube using 2005 analysis services. i have been using 2000 Analysis Services for about five years.

i have a cube with about 5 small dimensions and am trying to add a time dimension to include some of the Year to Year and Month to Month calculations.

i have a table with Year in column 1 and Month in column 2 mapped to the fact table.

before i add the time dimension everyting processes fine. after i add the Year-Month Hierarchy, the processing starts and gets to the SQL query to populate the cube but seems to go into a loop and never completes.

i don't have a clue what is going on.

does anyone have a suggestion?

Just want to make sure I understand the scenario ....

You have a Time dimension table with a structure similar to this:

create table DIM.Time (

TimeID int not null identity(1,1),

Year int null,

Month int null

...

)

Your fact table has a structure similar to this:

create table FACT.MyFact (

DimID int not null,

OtherDimID int not null,

TimeID int not null,

Measure1 money null,

...

)

Is this correct?

If so, do you get the "loop" when you process the Time dimension or just when you process the cube?

Thanks,

Bryan

|||

the dim time does not have a time id just year and month.

the fact table also has year and month associated with each fact.

the fact year and month are mapped to the dim year and month.

and the dim table is used for the dimension generation.

i also tried using the fact table year and month for the dimension generation with the same result.

the loop happens when i process the cube.

|||

I'd recommend using a single key for all foreign key references. If you don't have a surogate key for time, at least have a single smart key of YYYYMM in the fact table that references a single key in the dimension. Worst case, you can combine the year and month values in the fact table and the time dimension tables through the DSV.

Not 100% certain that's the source of your exact problem, but its worth giving it a shot.


B.

|||

That worked!

thanks.

i guess this version of Analysis Services is more traditionally Relational.

sql

creating a time dimension

this is my first cube using 2005 analysis services. i have been using 2000 Analysis Services for about five years.

i have a cube with about 5 small dimensions and am trying to add a time dimension to include some of the Year to Year and Month to Month calculations.

i have a table with Year in column 1 and Month in column 2 mapped to the fact table.

before i add the time dimension everyting processes fine. after i add the Year-Month Hierarchy, the processing starts and gets to the SQL query to populate the cube but seems to go into a loop and never completes.

i don't have a clue what is going on.

does anyone have a suggestion?

Just want to make sure I understand the scenario ....

You have a Time dimension table with a structure similar to this:

create table DIM.Time (

TimeID int not null identity(1,1),

Year int null,

Month int null

...

)

Your fact table has a structure similar to this:

create table FACT.MyFact (

DimID int not null,

OtherDimID int not null,

TimeID int not null,

Measure1 money null,

...

)

Is this correct?

If so, do you get the "loop" when you process the Time dimension or just when you process the cube?

Thanks,

Bryan

|||

the dim time does not have a time id just year and month.

the fact table also has year and month associated with each fact.

the fact year and month are mapped to the dim year and month.

and the dim table is used for the dimension generation.

i also tried using the fact table year and month for the dimension generation with the same result.

the loop happens when i process the cube.

|||

I'd recommend using a single key for all foreign key references. If you don't have a surogate key for time, at least have a single smart key of YYYYMM in the fact table that references a single key in the dimension. Worst case, you can combine the year and month values in the fact table and the time dimension tables through the DSV.

Not 100% certain that's the source of your exact problem, but its worth giving it a shot.


B.

|||

That worked!

thanks.

i guess this version of Analysis Services is more traditionally Relational.

Monday, March 19, 2012

Creating a Report Model from Analysis Services Cube then Editing

I have been told that you can create a Report Model from an Analysis Services
Cube in the Model Designer even though the documentation says you can not.
I can import the Analysis Project that contains the cube into BI Development
Studio but I can not create a model from that project.
Does anyone know how to create then edit a model in the Model Designer(BI
Development Studio not Management Studio or Report Manager) that is based on
an AS Cube?
--
New user - jhpuddyhave you noticed ? both while creating report model and cube you can see
something called "Data Source View" nothing but building relationships
between tables. so same refer your dw database and create view and you can
use report model to create reports using cube and view.
Amarnath
"jhpuddy" wrote:
> I have been told that you can create a Report Model from an Analysis Services
> Cube in the Model Designer even though the documentation says you can not.
> I can import the Analysis Project that contains the cube into BI Development
> Studio but I can not create a model from that project.
> Does anyone know how to create then edit a model in the Model Designer(BI
> Development Studio not Management Studio or Report Manager) that is based on
> an AS Cube?
> --
> New user - jhpuddy|||Amarnath,
Thank you for responding.
But the problem is that I can't create a model from a cube in BI Development
Studio. I can create one in Management Studio but I can not edit the Model
after it is created. We were planning on doing all of the formatting,
grouping and filtering in the model but we can not do that if we can not edit
it. The only thing that comes up for the model is the source code, can not
edit the code.
--
New user - jhpuddy
"Amarnath" wrote:
> have you noticed ? both while creating report model and cube you can see
> something called "Data Source View" nothing but building relationships
> between tables. so same refer your dw database and create view and you can
> use report model to create reports using cube and view.
> Amarnath
>
> "jhpuddy" wrote:
> > I have been told that you can create a Report Model from an Analysis Services
> > Cube in the Model Designer even though the documentation says you can not.
> > I can import the Analysis Project that contains the cube into BI Development
> > Studio but I can not create a model from that project.
> > Does anyone know how to create then edit a model in the Model Designer(BI
> > Development Studio not Management Studio or Report Manager) that is based on
> > an AS Cube?
> >
> > --
> > New user - jhpuddy|||You can do one thing If you have created a Analysis services project ie cube.
you can create one using "create datasource from other object" from add data
source.
Amarnath
"jhpuddy" wrote:
> Amarnath,
> Thank you for responding.
> But the problem is that I can't create a model from a cube in BI Development
> Studio. I can create one in Management Studio but I can not edit the Model
> after it is created. We were planning on doing all of the formatting,
> grouping and filtering in the model but we can not do that if we can not edit
> it. The only thing that comes up for the model is the source code, can not
> edit the code.
> --
> New user - jhpuddy
>
> "Amarnath" wrote:
> > have you noticed ? both while creating report model and cube you can see
> > something called "Data Source View" nothing but building relationships
> > between tables. so same refer your dw database and create view and you can
> > use report model to create reports using cube and view.
> >
> > Amarnath
> >
> >
> > "jhpuddy" wrote:
> >
> > > I have been told that you can create a Report Model from an Analysis Services
> > > Cube in the Model Designer even though the documentation says you can not.
> > > I can import the Analysis Project that contains the cube into BI Development
> > > Studio but I can not create a model from that project.
> > > Does anyone know how to create then edit a model in the Model Designer(BI
> > > Development Studio not Management Studio or Report Manager) that is based on
> > > an AS Cube?
> > >
> > > --
> > > New user - jhpuddy|||Yes, I know I have done that. It lets you create a data source but does not
recognize that data source when you try to create a data source view. It
puts you into a sort of loop.
--
New user - jhpuddy
"Amarnath" wrote:
> You can do one thing If you have created a Analysis services project ie cube.
> you can create one using "create datasource from other object" from add data
> source.
> Amarnath
> "jhpuddy" wrote:
> > Amarnath,
> >
> > Thank you for responding.
> >
> > But the problem is that I can't create a model from a cube in BI Development
> > Studio. I can create one in Management Studio but I can not edit the Model
> > after it is created. We were planning on doing all of the formatting,
> > grouping and filtering in the model but we can not do that if we can not edit
> > it. The only thing that comes up for the model is the source code, can not
> > edit the code.
> > --
> > New user - jhpuddy
> >
> >
> > "Amarnath" wrote:
> >
> > > have you noticed ? both while creating report model and cube you can see
> > > something called "Data Source View" nothing but building relationships
> > > between tables. so same refer your dw database and create view and you can
> > > use report model to create reports using cube and view.
> > >
> > > Amarnath
> > >
> > >
> > > "jhpuddy" wrote:
> > >
> > > > I have been told that you can create a Report Model from an Analysis Services
> > > > Cube in the Model Designer even though the documentation says you can not.
> > > > I can import the Analysis Project that contains the cube into BI Development
> > > > Studio but I can not create a model from that project.
> > > > Does anyone know how to create then edit a model in the Model Designer(BI
> > > > Development Studio not Management Studio or Report Manager) that is based on
> > > > an AS Cube?
> > > >
> > > > --
> > > > New user - jhpuddy

Creating a report model against an SSAS Cube in Visual Studio

I'm trying to create a report model in visual studio. I need the model
to report against an exiting cube. I can easily make the model in SQL
Server management studio. When I try to do the same in Visual Studio I
run up against a problem when I try to create the datasource view. The
steps I'm taking:
- I add a new Report Model Project into the solution that contains my
Analysis Services Project.
- I add a new datasource to the Report Model Project choosing to create
the source on an object and choosing the existing Analysis Services
Project.
- If I try to add a datasource view, the datasource I created doesn't
show up. (I've read in Microsoft documentation that this is designed
functionality)
- I can't find a way to create a report model directly against the
datasource and of course there is no datasource view. It would seem
that I should be able to create a report model directly against the
datasource since that's how both SQL Server Management Studio and the
reporting web interface works but I can't figure it out.
Can someone help me?I'm not sure I really understood what do you want to achieve
The way to create a model with Analysis Services data source is to :
a) open your Reporting Seervices with Mangement Studio
b) Choose your Analysis Services data source
c) Right click and choose "Generate a model..." from the contextual menu
Med Bouchenafa
"krosschell@.rdacorp.com" <talldrink@.gmail.com> a écrit dans le message de
news: 1138217467.115673.224510@.z14g2000cwz.googlegroups.com...
> I'm trying to create a report model in visual studio. I need the model
> to report against an exiting cube. I can easily make the model in SQL
> Server management studio. When I try to do the same in Visual Studio I
> run up against a problem when I try to create the datasource view. The
> steps I'm taking:
> - I add a new Report Model Project into the solution that contains my
> Analysis Services Project.
> - I add a new datasource to the Report Model Project choosing to create
> the source on an object and choosing the existing Analysis Services
> Project.
> - If I try to add a datasource view, the datasource I created doesn't
> show up. (I've read in Microsoft documentation that this is designed
> functionality)
> - I can't find a way to create a report model directly against the
> datasource and of course there is no datasource view. It would seem
> that I should be able to create a report model directly against the
> datasource since that's how both SQL Server Management Studio and the
> reporting web interface works but I can't figure it out.
> Can someone help me?
>|||When you say "Management Studio" I believe you are refering to SQL
Server Management Studio. I agree, creating a reporting model from
there is easy as cake. I'm trying to create a Reporting model from
Business Inteligence Management Studio. There is a project type "Report
Model Project" and I want to create a report model in this environemnt.
(one that uses a cube as it's data source). Does that make more sense?

Sunday, March 11, 2012

Creating a new measure that only sums data in specific part of cube

I have a cube with about 6 dimensions but only two are important right now. My main fact table is called MRSTATS. The dimension tables are Dim_Client#, and Dim_Test. I would like a measure called HospVol that only aggregates rows where MRSTATS.[Client#]=2. Then I need a measure called HospRVU that multiplies HospVol Measure by Dim_test.RVU. How do I got about configuring this?

Let me know if you need more information or if i'm going at this the wrong way. These values will be used in an SSRS report. Thank you very much.

I'm a little unclear on how you intend to set up your query, so my example may not be quite what you are looking for. Anyway, here is a sample query for AdventureWorks. I've broken down the calculations to make this easier to read:

Code Snippet

withmember [Measures].[Reseller Sales Amount Bikes] as

([Measures].[Reseller Sales Amount],[Product].[Category].[Category].[Bikes])

member [Measures].[List Price] as

IIF(

[Product].[List Price].CurrentMember.MemberValue=0,

NULL,

[Product].[List Price].CurrentMember.MemberValue)

member [Measures].[Bikes Sold] as

[Measures].[Reseller Sales Amount Bikes] /

[Measures].[List Price], format="#,#"

select

{

[Measures].[Reseller Sales Amount],

[Measures].[Reseller Sales Amount Bikes],

[Measures].[List Price],

[Measures].[Bikes Sold]

} on 0,

NONEMPTY [Product].[Product].[Product].Memberson 1

from [Adventure Works]

|||

To clarify things a little bit this is for labratory testing and Dim_Section is the section of the lab where the test was performed, Dim_Test is a table of the different tests and their various billing codes. Dim_Client# is a table of different Clients who we do testing for.

Alright the rows in my table in SSRS is going to be based on members of my Dim_Section Table and then my Dim_Test table and the columns are going to be attributes of the Dim_Test table as well as a few measure groups.

The only measure I have now is Volume which is a sum of the my item_qty field. I want a measure called HospVol which is the summation of the item_qty when the client# = 2 and all so a OtherVol for rows where client# !=2

I have done no work with MDX query text just the BI SSAS interface in SQL2005.

|||

Take a look at this code. The main thing to look at are the expressions at the top. Don't get too concerned with rows and columns just yet. SSRS will "flatten" your queries so that you establish the structure in the report. Main thing is to get the formulas right for you needs.

I wrote these samples against the AdventureWorks sample SSAS OLAP database. I'd recommend working with that database a bit to get comfortable with these concepts before applying them to your cubes.

Good Luck,
Bryan

Code Snippet

withmember [Measures].[Reseller Sales Amount Bikes] as

([Measures].[Reseller Sales Amount],[Product].[Category].[Category].[Bikes])

member [Measures].[Reseller Sales Amount Not Bikes] as

AGGREGATE(

EXCEPT(

[Product].[Category].[Category].Members,

[Product].[Category].[Category].[Bikes]

),

[Measures].[Reseller Sales Amount]

)

select

{

[Measures].[Reseller Sales Amount],

[Measures].[Reseller Sales Amount Bikes],

[Measures].[Reseller Sales Amount Not Bikes]

} on 0,

NONEMPTY [Date].[Calendar].[Calendar Year].Memberson 1

from [Adventure Works]

|||

Is there a way to set up my intended measure inside Business Intelligence SSAS without using MDX?

Otherwise could you give me a little insight on what the MDX code is actually used for? Is the MDX code used in building a cube and if so where can i edit the MDX code of the cube. Or is MDX used to run queries against the cube?

This is sort of what I get out of the above query: It sets up two new measures based on one existing measure. I dont know what 'on 0' means at the end of the select statement. The query uses the three measures and aggregates each for each year in the database. (Again, i dont know what 'on 1' means) and then [Adventure Works] is probably the cube name?

Could you direct me to a webpage about MDX?

Thanks for your help and patience.

|||

So, MDX is used for two things: defining expressions and assembling cell sets. The WITH MEMBER portions at the top of the sample are the expression approach. The SELECT ... FROM portion of the sample are the cell set construction part.

The SELECT stuff is only used when building queries. In cube design, you won't take advantage of this stuff. So, if the "on 0" and "on 1" stuff don't make a lot of sense, that's OK for now.

The WITH MEMBER stuff is the foundation for the MDX you would embedded in your cube as calculated members. Take a look at Books Online for topic "CREATE MEMBER statement".

I'm not aware of any books that cover MDX really deep. You may want to browse some of the books on SSAS as they should all cover calculated members and some basic MDX queries.

The best MDX learning resource I've found is this class http://www.hitachiconsulting.com/page.cfm?ID=trainingHandsOnMDXQueries. The schedule for the class is available at http://www.hitachiconsulting.com/page.cfm?ID=trainingSchedule and you would just need to click the email link at the bottom of the page to get the details on how to register. BTW, I need to disclose I work for Hitachi Consulting, the company providing this course.

Good luck,
Bryan

|||

So I think i've found the direction I need to go with this. I think I need to be making a caluculated member to do the aggregations I need. So this is the MDX I have right now based on the example you provided and some templates I found.

Code Snippet

CREATEMEMBERCURRENTCUBE.[MEASURES].[HospVol]

ASAGGREGATE

(

EXCEPT

(

[Dim Client#].[Dim Client#].Members,

[Dim Client#].[Dim Client#].&[2]

),

[Measures].[Item Qty]

)

FORMAT_STRING = "Standard";

The error I'm getting right now is "Error 1 Query (4, 1) Parser: The syntax for 'CREATE' is incorrect. 0 0"

How does this look to you? Thank you so much for your assistance.

|||

For anyone else looking for MDX documentation, here it is:

http://msdn2.microsoft.com/en-us/library/ms145506(SQL.90).aspx

|||

It looks like in the EXCEPT function you are trying to return all the members of your Dim Client dimension's Dim Client hierarchy except the member with a key of 2. Is that correct?

By executing the MEMBERS function against the hierarchy without specifiying the level, you will get the ALL member in your list. So, I would recommend using [Dim Client #].[Dim Client#].[Dim Client#].Members instead to return just the leaf level members and not the ALL level member.

Regarding the error, I don't know exactly what's going on with that. I would recommend creating the calculated member using the form- view of the Cube Designer's Calculations tab. This will help you get the overall syntax correct.

In the form view, you will need to give the calculated member a name, [HospVol]. (Be sure to include the brackets.)

You will need to identify it's parent hierarchy. In this case, select MEASURES.

Next, enter your expression: AGGREGATE(EXCEPT([Dim Client#].[Dim Client#].Members,[Dim Client#].[Dim Client#].&[2]),[Measures].[Item Qty])

Then, select your format string and visibility.

Finally, set the Non-Empty Behavior. This one is a little confusing but basically you identify a measure that when the measure is empty, the calculation is not performed. For this calculation, you can probably just ignore that.

Once you've set up the calculated member, just deploy your cube (you don't need to reprocess if the cube is already processed).

Good luck,
Bryan

|||

Hmm, I was going for nothing but Client# 2 so i'll have to look at that. It turns out that i'm going to need the except client# 2 so this one is still useful. I actually am using the form in the cube designer so thats probably why it was giving me the error with the create member.

I put in your expression and it evaluated but the aggregations are wrong because the values are higher than that of the total volume. I have confirmed that [Volume] has correct values so it must be a problem with the calculated member.

Here is my exact expression

Code Snippet

AGGREGATE(

EXCEPT(

[Dim Client#].[Dim Client#].Members,

[Dim Client#].[Dim Client#].&[2]),

[Measures].[Volume])

Could it be a problem with how is aggregating? That should be based on [Volume] though correct?

If it clears up anything with the Client# dimension, there are to attributes, [Dim_Client#] and [Org Client]. There's not exactly much of a heirarchy going on.

Would the aggregation of just Client# 2 be:

Code Snippet

AGGREGATE(

FILTER(

[Dim Client#].[Dim Client#].Members,

[Dim Client#].[Dim Client#].&[2]),

[Measures].[Volume])

This calculation takes a long time and returns blank cells. Maybe FILTER is the wrong keyword.

Am I going to run into any problems creating calculated members inside a non-measure dimension that multiply an measure by an attribute of the dimension?

Aside from this stuff, I think i'm pretty much ready to take this on by myself. Thanks for all your help

|||

Your expression needs to build a set of members and then cross join it to the measure of interest. This will generate a set of measure values associated with each member. That set can then be aggregated into a single value.

So, in the case where you want to get the set of all members that are NOT client key 2, the EXCEPT expression will give you that. If you want the set of just client 2, then just ask for that one member. Here is the set definition for each of these:

Code Snippet

EXCEPT([Dim Client#].[Dim Client#].Members,[Dim Client#].[Dim Client#].&[2])

Code Snippet

[Dim Client#].[Dim Client#].&[2]

So, we have a set of members. Now we need to cross join this to the measure of interest, [Measures].[Volumes]. This will give us one measure value for each member in the set. If we have just one member in the set, SSAS can return just that one value. If we have multiple members, we need to aggregate those values to get a single, returnable value.

Code Snippet

AGGREGATE(EXCEPT([Dim Client#].[Dim Client#].Members,[Dim Client#].[Dim Client#].&[2]),[Measures].[Volumes])

Code Snippet

([Dim Client#].[Dim Client#].&[2],[Measures].[Volumes])

As for the syntax problems, I'd kinda need to play with the cube to figure that one out. That's why we often use the WITH MEMBER syntax on a SELECT statement to get these things defined before moving them into the cube.

Anyway, hope that helps. Good luck.

Bryan

Creating a new measure that only sums data in specific part of cube

I have a cube with about 6 dimensions but only two are important right now. My main fact table is called MRSTATS. The dimension tables are Dim_Client#, and Dim_Test. I would like a measure called HospVol that only aggregates rows where MRSTATS.[Client#]=2. Then I need a measure called HospRVU that multiplies HospVol Measure by Dim_test.RVU. How do I got about configuring this?

Let me know if you need more information or if i'm going at this the wrong way. These values will be used in an SSRS report. Thank you very much.

I'm a little unclear on how you intend to set up your query, so my example may not be quite what you are looking for. Anyway, here is a sample query for AdventureWorks. I've broken down the calculations to make this easier to read:

Code Snippet

withmember [Measures].[Reseller Sales Amount Bikes] as

([Measures].[Reseller Sales Amount],[Product].[Category].[Category].[Bikes])

member [Measures].[List Price] as

IIF(

[Product].[List Price].CurrentMember.MemberValue=0,

NULL,

[Product].[List Price].CurrentMember.MemberValue)

member [Measures].[Bikes Sold] as

[Measures].[Reseller Sales Amount Bikes] /

[Measures].[List Price], format="#,#"

select

{

[Measures].[Reseller Sales Amount],

[Measures].[Reseller Sales Amount Bikes],

[Measures].[List Price],

[Measures].[Bikes Sold]

} on 0,

NONEMPTY [Product].[Product].[Product].Memberson 1

from [Adventure Works]

|||

To clarify things a little bit this is for labratory testing and Dim_Section is the section of the lab where the test was performed, Dim_Test is a table of the different tests and their various billing codes. Dim_Client# is a table of different Clients who we do testing for.

Alright the rows in my table in SSRS is going to be based on members of my Dim_Section Table and then my Dim_Test table and the columns are going to be attributes of the Dim_Test table as well as a few measure groups.

The only measure I have now is Volume which is a sum of the my item_qty field. I want a measure called HospVol which is the summation of the item_qty when the client# = 2 and all so a OtherVol for rows where client# !=2

I have done no work with MDX query text just the BI SSAS interface in SQL2005.

|||

Take a look at this code. The main thing to look at are the expressions at the top. Don't get too concerned with rows and columns just yet. SSRS will "flatten" your queries so that you establish the structure in the report. Main thing is to get the formulas right for you needs.

I wrote these samples against the AdventureWorks sample SSAS OLAP database. I'd recommend working with that database a bit to get comfortable with these concepts before applying them to your cubes.

Good Luck,
Bryan

Code Snippet

withmember [Measures].[Reseller Sales Amount Bikes] as

([Measures].[Reseller Sales Amount],[Product].[Category].[Category].[Bikes])

member [Measures].[Reseller Sales Amount Not Bikes] as

AGGREGATE(

EXCEPT(

[Product].[Category].[Category].Members,

[Product].[Category].[Category].[Bikes]

),

[Measures].[Reseller Sales Amount]

)

select

{

[Measures].[Reseller Sales Amount],

[Measures].[Reseller Sales Amount Bikes],

[Measures].[Reseller Sales Amount Not Bikes]

} on 0,

NONEMPTY [Date].[Calendar].[Calendar Year].Memberson 1

from [Adventure Works]

|||

Is there a way to set up my intended measure inside Business Intelligence SSAS without using MDX?

Otherwise could you give me a little insight on what the MDX code is actually used for? Is the MDX code used in building a cube and if so where can i edit the MDX code of the cube. Or is MDX used to run queries against the cube?

This is sort of what I get out of the above query: It sets up two new measures based on one existing measure. I dont know what 'on 0' means at the end of the select statement. The query uses the three measures and aggregates each for each year in the database. (Again, i dont know what 'on 1' means) and then [Adventure Works] is probably the cube name?

Could you direct me to a webpage about MDX?

Thanks for your help and patience.

|||

So, MDX is used for two things: defining expressions and assembling cell sets. The WITH MEMBER portions at the top of the sample are the expression approach. The SELECT ... FROM portion of the sample are the cell set construction part.

The SELECT stuff is only used when building queries. In cube design, you won't take advantage of this stuff. So, if the "on 0" and "on 1" stuff don't make a lot of sense, that's OK for now.

The WITH MEMBER stuff is the foundation for the MDX you would embedded in your cube as calculated members. Take a look at Books Online for topic "CREATE MEMBER statement".

I'm not aware of any books that cover MDX really deep. You may want to browse some of the books on SSAS as they should all cover calculated members and some basic MDX queries.

The best MDX learning resource I've found is this class http://www.hitachiconsulting.com/page.cfm?ID=trainingHandsOnMDXQueries. The schedule for the class is available at http://www.hitachiconsulting.com/page.cfm?ID=trainingSchedule and you would just need to click the email link at the bottom of the page to get the details on how to register. BTW, I need to disclose I work for Hitachi Consulting, the company providing this course.

Good luck,
Bryan

|||

So I think i've found the direction I need to go with this. I think I need to be making a caluculated member to do the aggregations I need. So this is the MDX I have right now based on the example you provided and some templates I found.

Code Snippet

CREATEMEMBERCURRENTCUBE.[MEASURES].[HospVol]

ASAGGREGATE

(

EXCEPT

(

[Dim Client#].[Dim Client#].Members,

[Dim Client#].[Dim Client#].&[2]

),

[Measures].[Item Qty]

)

FORMAT_STRING = "Standard";

The error I'm getting right now is "Error 1 Query (4, 1) Parser: The syntax for 'CREATE' is incorrect. 0 0"

How does this look to you? Thank you so much for your assistance.

|||

For anyone else looking for MDX documentation, here it is:

http://msdn2.microsoft.com/en-us/library/ms145506(SQL.90).aspx

|||

It looks like in the EXCEPT function you are trying to return all the members of your Dim Client dimension's Dim Client hierarchy except the member with a key of 2. Is that correct?

By executing the MEMBERS function against the hierarchy without specifiying the level, you will get the ALL member in your list. So, I would recommend using [Dim Client #].[Dim Client#].[Dim Client#].Members instead to return just the leaf level members and not the ALL level member.

Regarding the error, I don't know exactly what's going on with that. I would recommend creating the calculated member using the form- view of the Cube Designer's Calculations tab. This will help you get the overall syntax correct.

In the form view, you will need to give the calculated member a name, [HospVol]. (Be sure to include the brackets.)

You will need to identify it's parent hierarchy. In this case, select MEASURES.

Next, enter your expression: AGGREGATE(EXCEPT([Dim Client#].[Dim Client#].Members,[Dim Client#].[Dim Client#].&[2]),[Measures].[Item Qty])

Then, select your format string and visibility.

Finally, set the Non-Empty Behavior. This one is a little confusing but basically you identify a measure that when the measure is empty, the calculation is not performed. For this calculation, you can probably just ignore that.

Once you've set up the calculated member, just deploy your cube (you don't need to reprocess if the cube is already processed).

Good luck,
Bryan

|||

Hmm, I was going for nothing but Client# 2 so i'll have to look at that. It turns out that i'm going to need the except client# 2 so this one is still useful. I actually am using the form in the cube designer so thats probably why it was giving me the error with the create member.

I put in your expression and it evaluated but the aggregations are wrong because the values are higher than that of the total volume. I have confirmed that [Volume] has correct values so it must be a problem with the calculated member.

Here is my exact expression

Code Snippet

AGGREGATE(

EXCEPT(

[Dim Client#].[Dim Client#].Members,

[Dim Client#].[Dim Client#].&[2]),

[Measures].[Volume])

Could it be a problem with how is aggregating? That should be based on [Volume] though correct?

If it clears up anything with the Client# dimension, there are to attributes, [Dim_Client#] and [Org Client]. There's not exactly much of a heirarchy going on.

Would the aggregation of just Client# 2 be:

Code Snippet

AGGREGATE(

FILTER(

[Dim Client#].[Dim Client#].Members,

[Dim Client#].[Dim Client#].&[2]),

[Measures].[Volume])

This calculation takes a long time and returns blank cells. Maybe FILTER is the wrong keyword.

Am I going to run into any problems creating calculated members inside a non-measure dimension that multiply an measure by an attribute of the dimension?

Aside from this stuff, I think i'm pretty much ready to take this on by myself. Thanks for all your help

|||

Your expression needs to build a set of members and then cross join it to the measure of interest. This will generate a set of measure values associated with each member. That set can then be aggregated into a single value.

So, in the case where you want to get the set of all members that are NOT client key 2, the EXCEPT expression will give you that. If you want the set of just client 2, then just ask for that one member. Here is the set definition for each of these:

Code Snippet

EXCEPT([Dim Client#].[Dim Client#].Members,[Dim Client#].[Dim Client#].&[2])

Code Snippet

[Dim Client#].[Dim Client#].&[2]

So, we have a set of members. Now we need to cross join this to the measure of interest, [Measures].[Volumes]. This will give us one measure value for each member in the set. If we have just one member in the set, SSAS can return just that one value. If we have multiple members, we need to aggregate those values to get a single, returnable value.

Code Snippet

AGGREGATE(EXCEPT([Dim Client#].[Dim Client#].Members,[Dim Client#].[Dim Client#].&[2]),[Measures].[Volumes])

Code Snippet

([Dim Client#].[Dim Client#].&[2],[Measures].[Volumes])

As for the syntax problems, I'd kinda need to play with the cube to figure that one out. That's why we often use the WITH MEMBER syntax on a SELECT statement to get these things defined before moving them into the cube.

Anyway, hope that helps. Good luck.

Bryan

Creating a Matrix report from an OLAP cube

Hello there
I am trying to create a Matrix report from an OLAP cube
but not having any luck. the end result I want is the
UserName along the Row section, Months of the year along
the column section (the date range will be specified in
the MDX statement), and the Data will be a count of hits
(which is my Measure) to my website on a per month basis
and Grouped By the UserName. My MDX statement looks like
this:
SELECT
{[Time].[Calendar].[2004].[May]:[Time].[Calendar].[2004].
[June]} on Columns ,
{[Business].[User].[Business Entity Id].[5611].Children }
on Rows
FROM UsageStats_Phase1
This query executed in the MDX Sample Application returns
exactly what i want. but I am having trouble getting the
same information in a Matrix or Table report. Would anyone
have any idea how to go about doing this? I'm quite new to
MDX, OLAP, and Reporting Services (not a very strong
position to be in, i know!) - so any help would be very
much appreciated!
Thanks in anticipation
MariaMaybe you need to explicit the measures (something like:
SELECT {[Measures].[<MISURE_NAME>], [Measures].[<MISURE_NAme>],...} on Columns,
{[Business].[User].[Business Entity Id].[5611].Children }
on Rows,
{[Time].[Calendar].[2004].[May]:[Time].[Calendar].[2004].
[June]} ON PAGES
FROM UsageStats_Phase1
maybe you need also to use the DESCENDANTS function for rows and pages
)
than, using a matrix control, drag the measures in the data fields.
hth
Antonio
"Jano" wrote:
> Hello there
> I am trying to create a Matrix report from an OLAP cube
> but not having any luck. the end result I want is the
> UserName along the Row section, Months of the year along
> the column section (the date range will be specified in
> the MDX statement), and the Data will be a count of hits
> (which is my Measure) to my website on a per month basis
> and Grouped By the UserName. My MDX statement looks like
> this:
> SELECT
> {[Time].[Calendar].[2004].[May]:[Time].[Calendar].[2004].
> [June]} on Columns ,
> {[Business].[User].[Business Entity Id].[5611].Children }
> on Rows
> FROM UsageStats_Phase1
>
> This query executed in the MDX Sample Application returns
> exactly what i want. but I am having trouble getting the
> same information in a Matrix or Table report. Would anyone
> have any idea how to go about doing this? I'm quite new to
> MDX, OLAP, and Reporting Services (not a very strong
> position to be in, i know!) - so any help would be very
> much appreciated!
> Thanks in anticipation
> Maria
>|||Thanks for the reply. I managed to get around it by doing
the following:
SELECT
{ Measures.members } on Columns ,
{ Crossjoin( [Time].[Calendar].[2004].[May]:[Time].
[Calendar].[2004].[July], [Business].[User].[Business
Entity Id].[5611].Children ) } on Rows
FROM UsageStats_Phase1
All the best
Jano
>--Original Message--
>Maybe you need to explicit the measures (something like:
>
>SELECT {[Measures].[<MISURE_NAME>], [Measures].
[<MISURE_NAme>],...} on Columns,
>{[Business].[User].[Business Entity Id].
[5611].Children }
>on Rows,
>{[Time].[Calendar].[2004].[May]:[Time].[Calendar].[2004].
>[June]} ON PAGES
>FROM UsageStats_Phase1
>maybe you need also to use the DESCENDANTS function for
rows and pages
> )
>
>than, using a matrix control, drag the measures in the
data fields.
>
>hth
>Antonio
>
>"Jano" wrote:
>> Hello there
>> I am trying to create a Matrix report from an OLAP cube
>> but not having any luck. the end result I want is the
>> UserName along the Row section, Months of the year
along
>> the column section (the date range will be specified in
>> the MDX statement), and the Data will be a count of
hits
>> (which is my Measure) to my website on a per month
basis
>> and Grouped By the UserName. My MDX statement looks
like
>> this:
>> SELECT
>> {[Time].[Calendar].[2004].[May]:[Time].[Calendar].
[2004].
>> [June]} on Columns ,
>> {[Business].[User].[Business Entity Id].
[5611].Children }
>> on Rows
>> FROM UsageStats_Phase1
>>
>> This query executed in the MDX Sample Application
returns
>> exactly what i want. but I am having trouble getting
the
>> same information in a Matrix or Table report. Would
anyone
>> have any idea how to go about doing this? I'm quite new
to
>> MDX, OLAP, and Reporting Services (not a very strong
>> position to be in, i know!) - so any help would be very
>> much appreciated!
>> Thanks in anticipation
>> Maria
>.
>

Thursday, March 8, 2012

creating a HTTP Cube

Hi,

Please guide me in creating a HTTP cube and how to access it from OI designer.

Thanks

Can you please try and explain your problem in more detail.

You can access Analysis Services through HTTP, but not sure what do you expect from "HTTP cube".

What is "OI" you refer to?

Edward.
--
This posting is provided "AS IS" with no warranties, and confers no rights.

|||

hi,

sorry for not being clear. i wanted to access the Analysis Services from BusinessObjects by using the Http. Please could you guide in doing that.

thanks,

|||

Here is some information on how to provide HTTP access to your Analysis Server.

For AS2000
http://support.microsoft.com/default.aspx?scid=kb;en-us;279489
Please note that Standard edition is not supporting HTTP access

For AS2005
http://www.microsoft.com/technet/prodtechnol/sql/2005/httpssas.mspx
http://www.microsoft.com/technet/prodtechnol/sql/2005/httpasws.mspx

Hope that helps.

Edward.
--
This posting is provided "AS IS" with no warranties, and confers no rights.

Friday, February 24, 2012

Creating a Calculated Member Based on a Range

Is there a way to create a calculated member based on a range of values?

For example, I have two measures in my cube: ResponseTime and TransactionCount.

What I want to do is create a calculated member that returns the total number of Transactions where the ResponseTime is between a certain range, i.e. between 1 and 2 seconds.

Here is what I've tried to do:

IIF( [Measures].[ResponseTime] > 1 And [Measures].[ResponseTime] < 2, [Measures].[TransactionCount], 0)

However, when I browse the cube, all the values for this calculated member are blank. Any ideas?

This problem can easily can generalized. My main problem is just finding a way to group values based on a certain range of values.

Thanks!!

Joel,

Given that you want to look at the "response time" for each individual transaction in your fact table and the cube is going to show you values aggregated based on selections that the end user makes, you may want to consider the following solution:

In your data source view:

Add a name calculation to your fact table named "ResponseTimeRangeKey" using a CASE statement:

CASE

WHEN ResponseTime <= 1 THEN 1

WHEN ResponseTime > 1 AND ResponseTime < 2 THEN 2

ELSE 3

END CASE

Next you can create a dimension table that can be used to build a cube dimension for your response time ranges using either a database view or a named query with a simple SQL statement something like this:

SELECT

1 AS ResponseTimeRangeKey,

'1 sec or less' AS ResponseTimeRangeName

UNION

SELECT

2 AS ResponseTimeRangeKey,

'1-2 sec' AS ResponseTimeRangeName

UNION

SELECT

3 AS ResponseTimeRangeKey,

'more than 2 sec' AS ResponseTimeRangeName

You can then relate your fact table to the new dimension in the data source view. Next you can create your response time range dimension and add it to your cube.

This solution has the benefit of allowing users to look at any measure in your cube using the response time ranges and will accurately aggregate your values for all dimensions.

HTH,

Steve

|||

Thanks for the help. I tried it out, and it worked brilliantly.

|||

I have somewhat the same scenario, I need to find a way to group values based on certain range of values. I have a calculated member, YTD investment. From my fact table I created a named calculation field for SegmentID with initial value of -1 to relate it with Segment Dimension. The key -1 has "Unknown" as the caption. This SegmentID is my dimension key on the fact table and the key of Segment Dimension. The Segment Dimension has the Min and Max attributes where the minimum and maximum range of values for a particular dimension member is defined.

Is there a way for me to populate or assign values to the named calculation field SegmentID by getting the dimension key of segment dimension where the YTD Investment falls on segment dim's min and max attributes/range?

Thanks in advance,
May Lanie

|||

May,

This is can be tricky depending on the dimensionality of your cube and how you want the YTD to roll up. I have done this type of "dynamic" bucketing before using a separate measure group that only contains the row count for the fact table. You can then use the SCOPE function to allocate values along a pre-defined range of buckets according to the value you want to use for distribution purposes. Here is an example of what I am talking about:

Scope([Measures].[Customer Count by Bucket]);

([Bucket].[Bucket Key].[< 50K]) =

Filter(

Existing Customer.[Customer Name].[Customer Name].Members,

([Measures].[Sales Amt],[Bucket].[Bucket Key].[All Bucket]) <= 50000).Count;

([Bucket].[Bucket Key].[50K - 100K]) =

Filter(

Existing Customer.[Customer Name].[Customer Name].Members,

([Measures].[Sales Amt],[Bucket].[Bucket Key].[All Bucket]) > 50000 AND

([Measures].[Sales Amt],[Bucket].[Bucket Key].[All Bucket]) <= 100000).Count;

....

End Scope;

The "Measures.[Customer Count by Bucket]" is the fact table row count measure. There is a predefined "Bucket" dimension that has key values indicating a range, but you could just as easily use your "low" and "high" member values. The "Filter" statements are used to count the number of customers that fall into the buckets using "Sales Amt". You would need to substitute your "YTD Amount" calculation.

HTH,

Steve

Creating a calculated measure that filters

Hi,

Can I create a calculated member that will filter out based on a certain dimension? eg, I have a customer dimension and a sales cube. The sales cube has the sales count measure. Can I have a calculated measure that will give me the sales count for all customers that are flagged as 'New'? That way, I have a total count and a New customer count.

Thanks,

Brian

This should be very easy to do in MDX if you have attribute NewCustomer in the Customer dimension. The expression then would be something like

(Measures.[Sales Count], Customer.NewCustomer.[true])

|||

Thanks Mosha, indeed it is easy! I'd like to expand on this.

So, by adding a new calculated member, (Measures.[Sales Count], Customer.NewCustomer.[true]), it will give me the counts of new customers. Is is possible to now also filter on, say, customerStatus as well? eg.

My Sales cube also has a CustomerType dimension. How can I expand the filter above to also filter on the CustomerType dimension (say, customertype = E).

I'm still trying to get my head around MDX :)

Thanks!

Brian

|||I wouldn't call this "expansion" of the filter, it is more of "restricting" the filter further. Yes, you can add as many hierarchy members to the filter as you want. I recommend going over first few chapters of my "Fast Track to MDX" book to get yourself on the MDX track fast...

Friday, February 17, 2012

created my first cube now what?

I was able to create my first test production cube and i have a question about it. Do I need to have the cube rebuild/delpoy everyday cause the data in the server changes? (we truncate and rebuild the table that the cube pulls from if that matters.)

cheers.

Hello!

It is sufficient to do a full process of the dimensions and the cube. You have tasks that will help you with this in Integration services(SSISS).

HTH

Thomas Ivarsson