Showing posts with label services. Show all posts
Showing posts with label services. Show all posts

Friday, March 23, 2012

Median Calculation - Analysis Services

A really simple question,,,, I need to calculate the median of a
measure. I'm having a tough time to figure out which dimension to use.
If If I have 4 dimensions, Date, region, site, and process code and I
want to get the median for the measure number of days, what do I use to
define the set?
median ([Process].AllMembers,measures.[No Of Days]) this is not working,
but at least the syntax was clean
standard median prompt
Median (Set[, Numeric Expression])
As I select different subsets of region, site and process code I
obviously want the median of No of days to be dynamic.
Stuck here and waiting anxiously for some bright person to shed the
light!!!
thanks,,,
*** Sent via Developersdex http://www.examnotes.net ***
Don't just participate in USENET...get rewarded for it!I would try the sqlserver.olap group with this one. This is more the
relational engine area.
----
Louis Davidson - drsql@.hotmail.com
SQL Server MVP
Compass Technology Management - www.compass.net
Pro SQL Server 2000 Database Design -
http://www.apress.com/book/bookDisplay.html?bID=266
Blog - http://spaces.msn.com/members/drsql/
Note: Please reply to the newsgroups only unless you are interested in
consulting services. All other replies may be ignored :)
"Peter Weiler" <pweiler@.rogers.com> wrote in message
news:eLlFlRDIFHA.572@.tk2msftngp13.phx.gbl...
> A really simple question,,,, I need to calculate the median of a
> measure. I'm having a tough time to figure out which dimension to use.
> If If I have 4 dimensions, Date, region, site, and process code and I
> want to get the median for the measure number of days, what do I use to
> define the set?
> median ([Process].AllMembers,measures.[No Of Days]) this is not working,
> but at least the syntax was clean
> standard median prompt
> Median (Set[, Numeric Expression])
> As I select different subsets of region, site and process code I
> obviously want the median of No of days to be dynamic.
> Stuck here and waiting anxiously for some bright person to shed the
> light!!!
> thanks,,,
>
> *** Sent via Developersdex http://www.examnotes.net ***
> Don't just participate in USENET...get rewarded for it!

Wednesday, March 21, 2012

Measure Slicing Problem

Hi,

Please let me know whether the following requirement is possible in SQL Server Analysis Services 2005.

I have a fact table from which I have 4 measures M1, M2, M3 and M4. I have a dimension say D1,

Now I want that while browsing cube data the dimension D1 should slice M1 but it should not slice M2, M3 and M4.

What I feel is if we add the dimension to the fact table in Dimension Usage then it will slice all the measures coming from the fact table. If we remove the linkage of the dimension with the fact table in the Dimension Usage then the dimension will not slice any of the measures coming from that fact table.

The only solution that comes to my mind is by creating a duplicate of the fact table. But I dont want to do this as it would increase redundancy and make the DSV more complex.

Please let me know if I can do it in some other way.

Thanks in advance.

Regards,

Abhishek.

If M2-M4 are not related to D1 it sounds like they should be in a different fact table. However you should be able to achieve a similar outcome, buy overriding the context of D1 using a scope statement like the following.

SCOPE ({Measures.M2, Measures.M3, Measures.M4});

this = (D1.[All]);

END SCOPE;

Which pretty much says that for M2:M4, return the value of D1 at the top level, regardless of the current context of D1

|||

Hi,

Can you please tell me where should I write this scope statement.

Shoul I write it where I create the calculated member.

Thanks

Abhishek

|||You can only use scopes in the calculations section of the cube. You can either switch to script view and enter them or click the button on the tool bar that lets you add a new script command.|||

"The only solution that comes to my mind is by creating a duplicate of the fact table" - how about adding a Named Query on the fact table, which eliminates the field for D1 in the fact table? Then a new measure group could be created with this Named Query as the fact table, and measures M2, M3, M4. If the original fact table is like:

FT: <D1, D2, D3, D4, M1, M2, M3, M4>

then the Named Query could be like:

select D2, D3, D4, sum(M2) as M2, sum(M3) as M3, sum(M4) as M4

from FT

group by D2, D3, D4

Measure Slicing Problem

Hi,

Please let me know whether the following requirement is possible in SQL Server Analysis Services 2005.

I have a fact table from which I have 4 measures M1, M2, M3 and M4. I have a dimension say D1,

Now I want that while browsing cube data the dimension D1 should slice M1 but it should not slice M2, M3 and M4.

What I feel is if we add the dimension to the fact table in Dimension Usage then it will slice all the measures coming from the fact table. If we remove the linkage of the dimension with the fact table in the Dimension Usage then the dimension will not slice any of the measures coming from that fact table.

The only solution that comes to my mind is by creating a duplicate of the fact table. But I dont want to do this as it would increase redundancy and make the DSV more complex.

Please let me know if I can do it in some other way.

Thanks in advance.

Regards,

Abhishek.

If M2-M4 are not related to D1 it sounds like they should be in a different fact table. However you should be able to achieve a similar outcome, buy overriding the context of D1 using a scope statement like the following.

SCOPE ({Measures.M2, Measures.M3, Measures.M4});

this = (D1.[All]);

END SCOPE;

Which pretty much says that for M2:M4, return the value of D1 at the top level, regardless of the current context of D1

|||

Hi,

Can you please tell me where should I write this scope statement.

Shoul I write it where I create the calculated member.

Thanks

Abhishek

|||You can only use scopes in the calculations section of the cube. You can either switch to script view and enter them or click the button on the tool bar that lets you add a new script command.|||

"The only solution that comes to my mind is by creating a duplicate of the fact table" - how about adding a Named Query on the fact table, which eliminates the field for D1 in the fact table? Then a new measure group could be created with this Named Query as the fact table, and measures M2, M3, M4. If the original fact table is like:

FT: <D1, D2, D3, D4, M1, M2, M3, M4>

then the Named Query could be like:

select D2, D3, D4, sum(M2) as M2, sum(M3) as M3, sum(M4) as M4

from FT

group by D2, D3, D4

Measure Slicing Problem

Hi,

Please let me know whether the following requirement is possible in SQL Server Analysis Services 2005.

I have a fact table from which I have 4 measures M1, M2, M3 and M4. I have a dimension say D1,

Now I want that while browsing cube data the dimension D1 should slice M1 but it should not slice M2, M3 and M4.

What I feel is if we add the dimension to the fact table in Dimension Usage then it will slice all the measures coming from the fact table. If we remove the linkage of the dimension with the fact table in the Dimension Usage then the dimension will not slice any of the measures coming from that fact table.

The only solution that comes to my mind is by creating a duplicate of the fact table. But I dont want to do this as it would increase redundancy and make the DSV more complex.

Please let me know if I can do it in some other way.

Thanks in advance.

Regards,

Abhishek.

If M2-M4 are not related to D1 it sounds like they should be in a different fact table. However you should be able to achieve a similar outcome, buy overriding the context of D1 using a scope statement like the following.

SCOPE ({Measures.M2, Measures.M3, Measures.M4});

this = (D1.[All]);

END SCOPE;

Which pretty much says that for M2:M4, return the value of D1 at the top level, regardless of the current context of D1

|||

Hi,

Can you please tell me where should I write this scope statement.

Shoul I write it where I create the calculated member.

Thanks

Abhishek

|||You can only use scopes in the calculations section of the cube. You can either switch to script view and enter them or click the button on the tool bar that lets you add a new script command.|||

"The only solution that comes to my mind is by creating a duplicate of the fact table" - how about adding a Named Query on the fact table, which eliminates the field for D1 in the fact table? Then a new measure group could be created with this Named Query as the fact table, and measures M2, M3, M4. If the original fact table is like:

FT: <D1, D2, D3, D4, M1, M2, M3, M4>

then the Named Query could be like:

select D2, D3, D4, sum(M2) as M2, sum(M3) as M3, sum(M4) as M4

from FT

group by D2, D3, D4

Monday, March 12, 2012

MDX, dates and Calendar Control in Reporting services 2005

Hi,
I need to develop several reports in RS 2005 where the report
parameters are dates. The reports are based on a SQL Server 2005
Analysis Services Cube and consequently the reports need to be based
on MDX. My dates are formatted according to Swedish date standard. I
would like the users to pick the dates from a Calendar control.
(I have seen several smilar problems with dates, but all referring to
SQ statements, not MDX)
Here's my problem:
When I design my query in the Data tab of the report, I choose the
field that I want to use as a parameter (in this case a date) and tick
the checkbox indicating that I want a Report parameter created.
When I inspect the report in Preview, the date is not displayed in a
calendar, but instead as a tremendously long list. (Not good!) When I
look at the report parameter in Layout it has the datatype String.
- If I change the parameter to DateTime (in order to get a calendar),
I get a runtime error: "an error occurred during local report
processing. The property 'Valid Values' of report paramater
'KalenderDatum' doesn't have the expected type."
My question:
- What can I do to make Reporting Services understand that I want to
display dates?
- Can calendar controls be used with MDX at all'
- Is there someting I need to do in MDX to format my date as a
DateTime field?
- Does RS just not like Swedish' ;-)
Additional info:
- My cube is built on a staging database, and if I design a report
against that database with ordinary SQL statements using the same
DateTime field, I get a calendar control, and RS understands that I
want to display dates. Everything works fine.
- I have set the language property on my report to Swedish (the date
format being yyyy-mm-dd)
Please let me know if there is a workaround for this. Unfortunately
MDX is not exactly my second language either...
CarinaI had the same problem (but with US date formats). What you need to do is on
the "Data" tab in your RS project, change the MDX query to an expression by
putting an = there followed by your whole MDX query in double quotes. Then
concantenate in your parameter date fields. Here is an example of how I did
it for a range on [Start Date] based on 2 datetime parameters called
Begin_Date and End_Date. Note, be sure there are no control characters or
carriage returns in your MDX expression.
="SELECT NON EMPTY { [Measures].[Login Count]} ON COLUMNS, NON EMPTY {
[GroupUsers].[Application - Name].[Login Name].ALLMEMBERS * [Date].[Start
Date].&[" & Format(Parameters!Begin_Date.Value,"MM/dd/yyyy") &
"]:[Date].[Start Date].&[" & Format(Parameters!End_Date.Value,"MM/dd/yyyy") &
"] } DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS FROM
[MyCubeDataset])) CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR,
FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS"
I just set up regular Datetime report parameters for Begin_Date and End_Date
and added them to the dataset on the parameters tab. I formatted them into
the format I wanted inside the expression above because I needed the leading
zeroes for the date comparisons to work in MDX. Also, here is a link that
helped me:
http://msdn2.microsoft.com/en-us/library/aa902647(sql.80).aspx
Hope this helps.
"carina.jones@.sogeti.se" wrote:
> Hi,
> I need to develop several reports in RS 2005 where the report
> parameters are dates. The reports are based on a SQL Server 2005
> Analysis Services Cube and consequently the reports need to be based
> on MDX. My dates are formatted according to Swedish date standard. I
> would like the users to pick the dates from a Calendar control.
> (I have seen several smilar problems with dates, but all referring to
> SQ statements, not MDX)
> Here's my problem:
> When I design my query in the Data tab of the report, I choose the
> field that I want to use as a parameter (in this case a date) and tick
> the checkbox indicating that I want a Report parameter created.
> When I inspect the report in Preview, the date is not displayed in a
> calendar, but instead as a tremendously long list. (Not good!) When I
> look at the report parameter in Layout it has the datatype String.
> - If I change the parameter to DateTime (in order to get a calendar),
> I get a runtime error: "an error occurred during local report
> processing. The property 'Valid Values' of report paramater
> 'KalenderDatum' doesn't have the expected type."
> My question:
> - What can I do to make Reporting Services understand that I want to
> display dates?
> - Can calendar controls be used with MDX at all'
> - Is there someting I need to do in MDX to format my date as a
> DateTime field?
> - Does RS just not like Swedish' ;-)
> Additional info:
> - My cube is built on a staging database, and if I design a report
> against that database with ordinary SQL statements using the same
> DateTime field, I get a calendar control, and RS understands that I
> want to display dates. Everything works fine.
> - I have set the language property on my report to Swedish (the date
> format being yyyy-mm-dd)
>
> Please let me know if there is a workaround for this. Unfortunately
> MDX is not exactly my second language either...
> Carina
>|||Thank you so much for your input! With your help and the explanation
below I did figure it out :-). I'm a happy camper!
/Carina
In short (found this explanation on another site):
1. Develop the report.
2. Change the Data Type of the date parameters to DateTime, and set
Available Values to Non-queried.
3. On the Data tab, edit the cube's Dataset (click on the ... button).
4. Click on the Parameters tab of the Dataset dialog box. Replace the
Value of the date parameters with ="[Dimension].[Member].&[" +
Format(CDate(Parameters!ParameterName.Value), "yyyy-MM-ddT00:00:00") +
"]" where [Dimension].[Member] and ParameterName are the dimensions
and parameter names of your particular cube. Depending on how your
dimension is set up, you may also need to change the format of the
date.
5. There is no need to change the MDX of the query.

MDX to consolidate dates with measures by columns

I have a cube in SQL Server Analysis Services 2005 that has a structure like:

Measures:
Number of Tickets ([Measures].[Number of Tickets])

Dimensions:
Submitted Date ([Submit Date].[Date].[Date])
Submitted By ([Submit By].[Name].[Name])
Assigned Date ([Assigned Date].[Date].[Date])
Assigned To ([Assign To].[Name].[Name])
Resolved Date ([Resolved Date].[Date].[Date])
Resolved By ([Resolved By].[Name].[Name])
....
I would like to have returned a result set that cosolidates the dates with the number of tickets for each (or similarly, consolidates the people with the number of tickets for each). I need a set of all dates back, with the number of tickets aliased appropriately, so that I end up with something similar to the following:

Date # Tickets Submitted # Tickets Assigned # Tickets Resolved
April 1, 2007 14 27 11

April 2, 2007 11 4 null

April 3, 2007 null null 5
... etc.

What is the MDX to do this? I know how I would do it in t-sql, but unfortunately I'm not very proficient in mdx yet. I have tried using LinkMember and can get a single set of dates, but still don't know how to get the different ticket counts for each.

You might be able to figure something out with LinkMember, but it could get messy.

Have you considered changing your structure and setting up a couple of common dimensions instead? This should make a lot of different analysis a lot easier.

Measures:

SubmittedCount, AssignedCount, ResovledCount

Dimensions:

Date

Person

Or even something like

Measures:

ActivityCount

Dimensions:

Date

Person

Activity (Submitted, Resolved, Assigned)

|||

Hi Patty,

as Darren said one possibility is to change the structure of your measuregroup. If you are not able to do so you could try the following (SLOWER!!!) MDX.

If you use the same Date Dimension for all your Dates (-> Same Keys) you can use Filter or VBA to calculate your measures. I tried this in Adventureworks and for me the VBA was faster.

Here The MDX I used in Adventure Works DW:

Code Snippet

WITH MEMBER Measures.[Orders Delivered]

--AS ([Measures].[Order Count], ROOT([Date]), FILTER([Delivery Date].[Date].[Date].MEMBERS, [Delivery Date].[Date].MEMBER_KEY = [Date].[Date].CURRENTMEMBER.MEMBER_KEY).Item(0))

AS ([Measures].[Order Count], ROOT([Date]), StrToMember(VBA!CSTR("[Delivery Date].[Date].&[" + [Date].[Date].CURRENTMEMBER.MEMBER_KEY +"]")))

SELECT

{[Measures].[Order Count],Measures.[Orders Delivered] } ON COLUMNS,

{[Date].[Date].[Date].MEMBERS} ON ROWS

FROM [Adventure Works]

As u see I use the Key Of the Current Date to generate the UNIQUE_NAME in the other date dimension with vba. You should be able to replace Date with Submitted Date and Delivery Date with Assigned Date.

Hope this helps

Markus

MDX support in next version of Rept. Svcs. (MS Question)

Hi. We are doing quite a bit of work with Analysis Server and Report
Services. I understand the next version of Rept Svcs will support Analysis
Server and MDX queries quite a bit better.
So before we put a lot of effort in building better support for creating MDX
based reports, I would like to understand what that support will be and an
estimate when it will be avail. for beta testing.
Thanks,
BillBill,
I hope you don't mind that I am not from Microsoft. One of the Analysis
Services-related enhancements that you will see is the MDX Query Builder
which is included in Beta 2 and you can try out now. Another feature will be
ad-hoc reporting off Analysis Services (not publicly available yet).
--
Hope this helps.
---
Teo Lachev, MVP [SQL Server], MCSD, MCT
Author: "Microsoft Reporting Services in Action"
Publisher website: http://www.manning.com/lachev
Buy it from Amazon.com: http://shrinkster.com/eq
Home page and blog: http://www.prologika.com/
---
"billd" <billd@.discussions.microsoft.com> wrote in message
news:5C27B67A-B855-4BE2-B049-7593857CD643@.microsoft.com...
> Hi. We are doing quite a bit of work with Analysis Server and Report
> Services. I understand the next version of Rept Svcs will support Analysis
> Server and MDX queries quite a bit better.
> So before we put a lot of effort in building better support for creating
MDX
> based reports, I would like to understand what that support will be and an
> estimate when it will be avail. for beta testing.
> Thanks,
> Bill
>
>|||Hi Teo,
Can you define "ad-hoc reporting off Analysis Services" in this context ?
Also: will we get something better than flattened recordsets (ADO MD
cellsets!) ?
Thanks,
Tom
"Teo Lachev [MVP]" wrote:
> Bill,
> I hope you don't mind that I am not from Microsoft. One of the Analysis
> Services-related enhancements that you will see is the MDX Query Builder
> which is included in Beta 2 and you can try out now. Another feature will be
> ad-hoc reporting off Analysis Services (not publicly available yet).
> --
> Hope this helps.
> ---
> Teo Lachev, MVP [SQL Server], MCSD, MCT
> Author: "Microsoft Reporting Services in Action"
> Publisher website: http://www.manning.com/lachev
> Buy it from Amazon.com: http://shrinkster.com/eq
> Home page and blog: http://www.prologika.com/
> ---
> "billd" <billd@.discussions.microsoft.com> wrote in message
> news:5C27B67A-B855-4BE2-B049-7593857CD643@.microsoft.com...
> > Hi. We are doing quite a bit of work with Analysis Server and Report
> > Services. I understand the next version of Rept Svcs will support Analysis
> > Server and MDX queries quite a bit better.
> >
> > So before we put a lot of effort in building better support for creating
> MDX
> > based reports, I would like to understand what that support will be and an
> > estimate when it will be avail. for beta testing.
> >
> > Thanks,
> > Bill
> >
> >
> >
> >
>
>

Wednesday, March 7, 2012

MDX query with parameter using OleDb?

I posted this question on the Analysis Services forum ( http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1087288&SiteID=1 ) and Irina asked me to post it over here to get an answer.

I'm trying to run an MDX query against SSAS2005 with a parameter. It works fine with ADOMD.NET, but I can't get it to work using OleDb. (I have to use OleDb because of limitations of the calling application.) Is this possible?

The following code works:

//using Microsoft.AnalysisServices.AdomdClient;

string MDX = "with member [Measures].[Test] as Str(@.Param1) "

+ "SELECT [Measures].[Test] on 0, "

+ "[Product].[Category].[Category].Members on 1 "

+ "from [Adventure Works]";

AdomdConnection conn = new AdomdConnection("Provider=MSOLAP.3;Data Source=localhost;Initial Catalog=Adventure Works DW;Integrated Security=SSPI;Persist Security Info=false;");

conn.Open();

AdomdCommand cmd = new AdomdCommand(MDX, conn);

cmd.Parameters.Add("Param1", "abcde");

System.Data.DataSet ds = new System.Data.DataSet();

AdomdDataAdapter adp = new AdomdDataAdapter(cmd);

adp.Fill(ds);

Console.WriteLine(ds.Tables[0].Rows[0][1]);

conn.Close();

The following code fails:

//using System.Data.OleDb;

string MDX = "with member [Measures].[Test] as Str(@.Param1) "

+ "SELECT [Measures].[Test] on 0, "

+ "[Product].[Category].[Category].Members on 1 "

+ "from [Adventure Works]";

OleDbConnection conn = new OleDbConnection("Provider=MSOLAP.3;Data Source=localhost;Initial Catalog=Adventure Works DW;Integrated Security=SSPI;Persist Security Info=false;");

conn.Open();

OleDbCommand cmd = new OleDbCommand(MDX, conn);

cmd.Parameters.AddWithValue("Param1", "abcde"); //changing it to @.Param1 doesn't help

System.Data.DataSet ds = new System.Data.DataSet();

OleDbDataAdapter adp = new OleDbDataAdapter(cmd);

adp.Fill(ds); //produces error: "The following system error occurred: The parameter is incorrect. . Error Code = 0x80070057, External Code = 0x00000000:."

Console.WriteLine(ds.Tables[0].Rows[0][1]);

conn.Close();

reported this issue to connect:

https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=251601

I hope that's the right place to report OleDb bugs.

MDX query with parameter using OleDb?

I posted this question on the Analysis Services forum ( http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1087288&SiteID=1 ) and Irina asked me to post it over here to get an answer.

I'm trying to run an MDX query against SSAS2005 with a parameter. It works fine with ADOMD.NET, but I can't get it to work using OleDb. (I have to use OleDb because of limitations of the calling application.) Is this possible?

The following code works:

//using Microsoft.AnalysisServices.AdomdClient;

string MDX = "with member [Measures].[Test] as Str(@.Param1) "

+ "SELECT [Measures].[Test] on 0, "

+ "[Product].[Category].[Category].Members on 1 "

+ "from [Adventure Works]";

AdomdConnection conn = new AdomdConnection("Provider=MSOLAP.3;Data Source=localhost;Initial Catalog=Adventure Works DW;Integrated Security=SSPI;Persist Security Info=false;");

conn.Open();

AdomdCommand cmd = new AdomdCommand(MDX, conn);

cmd.Parameters.Add("Param1", "abcde");

System.Data.DataSet ds = new System.Data.DataSet();

AdomdDataAdapter adp = new AdomdDataAdapter(cmd);

adp.Fill(ds);

Console.WriteLine(ds.Tables[0].Rows[0][1]);

conn.Close();

The following code fails:

//using System.Data.OleDb;

string MDX = "with member [Measures].[Test] as Str(@.Param1) "

+ "SELECT [Measures].[Test] on 0, "

+ "[Product].[Category].[Category].Members on 1 "

+ "from [Adventure Works]";

OleDbConnection conn = new OleDbConnection("Provider=MSOLAP.3;Data Source=localhost;Initial Catalog=Adventure Works DW;Integrated Security=SSPI;Persist Security Info=false;");

conn.Open();

OleDbCommand cmd = new OleDbCommand(MDX, conn);

cmd.Parameters.AddWithValue("Param1", "abcde"); //changing it to @.Param1 doesn't help

System.Data.DataSet ds = new System.Data.DataSet();

OleDbDataAdapter adp = new OleDbDataAdapter(cmd);

adp.Fill(ds); //produces error: "The following system error occurred: The parameter is incorrect. . Error Code = 0x80070057, External Code = 0x00000000:."

Console.WriteLine(ds.Tables[0].Rows[0][1]);

conn.Close();

reported this issue to connect:

https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=251601

I hope that's the right place to report OleDb bugs.

MDX query to aggregate distinct count

Hi there

I'm after some help with an mdx query, I'm using SQL 2005 analysis services and I want to create a query which compares the most recent three months with three months 1 month prior. The measure i want to compare is a distinct count so can't use sum to combine. i attempted to use (for the current 3 months);

aggregate([Dim Date].[Calendar Year].CurrentMember.Lag(3) :

[Dim Date].[Calendar Year].CurrentMember,

[Measures].[Active Player Count])

but got an error that I can't use aggregate on a calculated member, the measure Active Player Count is a standard measure that has distinct count measure as it's aggregation.

Hi,

It's not clear from the MDX fragment here what exactly you're trying to do, but here's an example using Adventure Works which does something similar:

WITH MEMBER MEASURES.LASTTHREEMONTHS AS

AGGREGATE([Date].[Calendar].CURRENTMEMBER : [Date].[Calendar].CURRENTMEMBER.LAG(2),[Measures].[Customer Count])

MEMBER MEASURES.LASTTHREEMONTHSONEPRIOR AS

AGGREGATE([Date].[Calendar].CURRENTMEMBER.PREVMEMBER : [Date].[Calendar].CURRENTMEMBER.LAG(3),[Measures].[Customer Count])

SELECT {[Measures].[Customer Count], MEASURES.LASTTHREEMONTHS,MEASURES.LASTTHREEMONTHSONEPRIOR} ON 0,

[Date].[Calendar].[Calendar Quarter].&[2003]&[4].CHILDREN

ON 1

FROM

[Adventure Works]

HTH,

Chris

|||

thanks Chris

Looks like I had the same query but had the lag around the wrong way , I had the lag (3) in the first part of the equation rather than the second.

Derek

MDx Query Parameters

Hi,
I'm trying to use mdx query in reporting services with a parameters.
But I am getting an error telling me my token is invalid my query
string is this:
SELECT NON EMPTY { [Measures].[Executions] } ON COLUMNS, NON EMPTY
{ Members("[Dates].[All Dates].[" + @.Year + "]." + "[June]") }
DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS FROM
[Procedure Completions] CELL PROPERTIES VALUE
I've declared Year right now I am just using the default value of 2007
but I keep on getting this error:
Formula error - syntax error - token is not valid: "{ Members("[Dates].
[All Dates].[" + ^@.^Year+"]." + "[June]") }" (urn:schemas-microsoft-
com:xml-analysis)
Any ideas of what I could be doing wrong?Try using the following:
{ Members(STRTOSET("[Dates].[All Dates].[" + @.Year + "]." + "[June]"),
CONSTRAINED) }
Although if I were doing it I would do it like this.
{Members(STRTOSET(@.Dateparameter,CONSTRAINED))} and then do the string
manipulation in the parameters section of the data set properties. The DS
properties are the "..." next to the name of the DS. You can use VB to
create an expression in there. This way you can use the query builder to
create your MDX for you.
Hope this helps,
Al
<RMurjani85@.gmail.com> wrote in message
news:1185475682.673977.86900@.g4g2000hsf.googlegroups.com...
> Hi,
> I'm trying to use mdx query in reporting services with a parameters.
> But I am getting an error telling me my token is invalid my query
> string is this:
> SELECT NON EMPTY { [Measures].[Executions] } ON COLUMNS, NON EMPTY
> { Members("[Dates].[All Dates].[" + @.Year + "]." + "[June]") }
> DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS FROM
> [Procedure Completions] CELL PROPERTIES VALUE
> I've declared Year right now I am just using the default value of 2007
> but I keep on getting this error:
> Formula error - syntax error - token is not valid: "{ Members("[Dates].
> [All Dates].[" + ^@.^Year+"]." + "[June]") }" (urn:schemas-microsoft-
> com:xml-analysis)
> Any ideas of what I could be doing wrong?
>

MDX query on a dimension member

Is it possible to query an analysis services dimension using MDX select syntax, if so

can someone list a example?

For example there is an employee dimension with Employee Name as the member name

and Employee ID as the member property. I want to write an MDX query to return the member name

if I have the member property.

Thanks

Umesh

Yes. Something like:

select { ... } on 0
from [$Your Dimension Name]

You can attach SQL profiler to the server and browse a dimension from BI Studio or SQL Server Management Studio. The profiler will trace the queries we send.

MDX query for an Histogram

Hi All,

Trying to plot an Histogram chart in Reporting services using the data source as a cube. Currently the cube doesnt retrives the intervals from the cube for which the count is 0. I need the chart to show all the intervals everytime even when the count for that particular interval is 0.

Has anyone created any such chart? or can any one please help me with the correct MDX query for it.

Awaiting a response.

Regards,
Sumeet

What you will find is that if a count measure does not have any values it will be empty rather than 0 and in your query you probably have a "NON EMPTY" statement on the axis which is excluding the empty cells. Removing the "NON EMPTY" clause from the axis in question should display the members with empty (0) values. If this does not help, posting your query might help in seeing what is going on.|||

The Non empty thing doesnt works, already tried with that. The query used in the Data source view is as follows:-

Case when Earned_Value <> 0 or Earned_Value <> null then
Case when CAST((Earned_Value - Actual_Cost)/Earned_Value AS decimal(8,2)) < -0.50 then
'Less than -50%'
when CAST((Earned_Value - Actual_Cost)/Earned_Value AS decimal(8,2)) between -0.50 and -0.41 then
'-41% to -50%'
when CAST((Earned_Value - Actual_Cost)/Earned_Value AS decimal(8,2)) between -0.40and -0.31 then
'-31% to -40%'
when CAST((Earned_Value - Actual_Cost)/Earned_Value AS decimal(8,2)) between -0.30 and -0.21 then
'-21% to -30%'
when CAST((Earned_Value - Actual_Cost)/Earned_Value AS decimal(8,2)) between -0.20 and -0.11 then
'-11% to -20%'
when CAST((Earned_Value - Actual_Cost)/Earned_Value AS decimal(8,2)) between -0.10 and -0.01 then
'-1% to -10%'
when CAST((Earned_Value - Actual_Cost)/Earned_Value AS decimal(8,2)) = 0 then
'0%'
when CAST((Earned_Value - Actual_Cost)/Earned_Value AS decimal(8,2)) between 0.01 and 0.10 then
'1% to 10%'
when CAST((Earned_Value - Actual_Cost)/Earned_Value AS decimal(8,2)) between 0.11 and 0.20 then
'11% to 20%'
when CAST((Earned_Value - Actual_Cost)/Earned_Value AS decimal(8,2)) between 0.21 and 0.30 then
'21% to 30%'
when CAST((Earned_Value - Actual_Cost)/Earned_Value AS decimal(8,2)) between 0.31 and 0.40 then
'31% to 40%'
when CAST((Earned_Value - Actual_Cost)/Earned_Value AS decimal(8,2)) between 0.41 and 0.50 then
'41% to 50%'
when CAST((Earned_Value - Actual_Cost)/Earned_Value AS decimal(8,2)) > 0.50 then
'Above 50%'
end
end

The above query excludes the intervals itself for which their is not a value and thus no zero value is assigned to that interval as the interval itself doesnot exists. So actually the above query itself should be modified so that zero value can be assigned to the intervals for which no value is present.

Do anyone have an idea how this can be done?

Regards,
Sumeet

|||

I'm not sure if this will help or not, you have swapped from talking about an MDX query against the cube to wanting to change a named view in the DSV. But if all you want to do is to assign the records with 0 or no Earned_Value some sort of label, then adding the lines in red below should fix this.

Case when Earned_Value <> 0 or Earned_Value <> null then
Case when CAST((Earned_Value - Actual_Cost)/Earned_Value AS decimal(8,2)) < -0.50 then
'Less than -50%'
when CAST((Earned_Value - Actual_Cost)/Earned_Value AS decimal(8,2)) between -0.50 and -0.41 then
'-41% to -50%'
when CAST((Earned_Value - Actual_Cost)/Earned_Value AS decimal(8,2)) between -0.40and -0.31 then
'-31% to -40%'
when CAST((Earned_Value - Actual_Cost)/Earned_Value AS decimal(8,2)) between -0.30 and -0.21 then
'-21% to -30%'
when CAST((Earned_Value - Actual_Cost)/Earned_Value AS decimal(8,2)) between -0.20 and -0.11 then
'-11% to -20%'
when CAST((Earned_Value - Actual_Cost)/Earned_Value AS decimal(8,2)) between -0.10 and -0.01 then
'-1% to -10%'
when CAST((Earned_Value - Actual_Cost)/Earned_Value AS decimal(8,2)) = 0 then
'0%'
when CAST((Earned_Value - Actual_Cost)/Earned_Value AS decimal(8,2)) between 0.01 and 0.10 then
'1% to 10%'
when CAST((Earned_Value - Actual_Cost)/Earned_Value AS decimal(8,2)) between 0.11 and 0.20 then
'11% to 20%'
when CAST((Earned_Value - Actual_Cost)/Earned_Value AS decimal(8,2)) between 0.21 and 0.30 then
'21% to 30%'
when CAST((Earned_Value - Actual_Cost)/Earned_Value AS decimal(8,2)) between 0.31 and 0.40 then
'31% to 40%'
when CAST((Earned_Value - Actual_Cost)/Earned_Value AS decimal(8,2)) between 0.41 and 0.50 then
'41% to 50%'
when CAST((Earned_Value - Actual_Cost)/Earned_Value AS decimal(8,2)) > 0.50 then
'Above 50%'
end
else
'no value'
end

Saturday, February 25, 2012

MDX Query designer working correctly?

I've been working with the MDX query designer in Reporting Services 2005 (RTM Developer Edition) and have come across a behavior that does not seem correct.
I can build a report using the wizzard, preview it, deploy it, and all is good with the world. But if I so much as click on the Data tab in the report designer, the report becomes invalid.
Is this by design, or is there some other way to edit a report created with the MDX query designer?
Regards,
Clayton

This is known issue in Report Designer.

Here is workaround:

1. After the report wizard completes, close the report.

2. Open the report in code view

3. Edit the report removing all carriage returns and all whitespace (blanks) between the two tags

<rd:MdxQuery> and <QueryDefinition>

4. Save the report and close the window

5. Open the report in Design Mode.

MDX query designer behaving correctly in Reporting Services?

I've been working with the MDX query designer in Reporting Services 2005 (RTM Developer Edition) and have come across a behavior that does not seem correct.

I can build a report using the wizzard, preview it, deploy it, and all is good with the world. But if I so much as click on the Data tab in the report designer, the report becomes invalid.

Is this by design, or is there some other way to edit a report created with the MDX query designer?

Regards,

Clayton

This is apparently a known problem. I posted this to the Reporting Services forum as well and recieved an answer there. Heres the link:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=171034&SiteID=1

Regards,

Clayton

MDX Queries within .NET SSAS stored procedures (using ADOMD.NET Server library)

It seems like it is not possible to write MDX queries within Analysis Services Stored procedures utilizing the Microsoft.AnalysisServices.AdomdServer library. Is this correct ?

I am able to execute DMX queries but not sure about MDX

Can anyone elaborate on this ?

thanks

anil

Not sure with it, but you can check in:

http://technet.microsoft.com/en-us/library/ms175314.aspx

http://www.codeplex.com/ASStoredProcedures/Project/ProjectRss.aspx

|||

That is basically correct. Stored Procedures in SSAS can return things like values, members, sets, tuples, but they are not built to execute queries. At least in their current form, "Stored Procedures" is not really a good name, they are more like .Net user defined functions.

Technically it would be possible to use the CALL syntax to open up a second ADOMD connection and execute an MDX query and return the result as a rowset, but that would require that the stored proc have unrestricted permissions and it is not really a recommended practice.

|||

Darren

Thanks, i agree that this should really be called a .NET user defined function

I was hoping to obtain a AdomdDataReader for an MDX query and process the results in the .NET user defined function, so getting a rowset will not work for me. I will have to resort to processing on the client, using the client libraries

anil

MDX queries from Reporting Services

I have been having some issues with generating reports in Reporting Services off Analysis Services, in that the reports take a very long time and I have to often kill the queries. They are using 100%CPU. I have then replicated as closely as possible the report using the Cube Analysis add in for Excel, and the response is almost instantaneous.

It seems it is the MDX that Reporting Services is very inefficient compared to that generated by Cube Analysis. It uses Selects in the From clause to restrict the scope of the query using the Filter parameters. Is this something anyone has come across, and are there any suggestions to get round it? I did try to paste the Cube Analysis MDX into Reporting Services but the parser rejected it as invalid.

I attach the comparitive MDX below for reference

Cube Analysis
SELECT NON EMPTY{Hierarchize({CROSSJOIN({CROSSJOIN({{{[Portfolio].[Benchmark Portfolio].[All],[Portfolio].[Benchmark Portfolio].[All].children} + {{[Portfolio].[Benchmark Portfolio].[Benchmark].&[1].children}}}},{{[Scenario].[Scenario].&[1],[Scenario].[Scenario].&[1].children} + {[Scenario].[Scenario].&[3],[Scenario].[Scenario].&[3].children} + {[Scenario].[Scenario].[Benchmark],[Scenario].[Scenario].[Benchmark].children} + {[Scenario].[Scenario].[Variance to Benchmark],[Scenario].[Scenario].[Variance to Benchmark].children}})},{{[Measures].[Duration]} + {[Measures].[Weighting]}})})} on 0, NON EMPTY{Hierarchize({{[Sector].[Sector Category].[All],[Sector].[Sector Category].[All].children}})} on 1 from [MIQB27] where ([Period].[Year- Month].[Month].&[2006-03-01T00:00:00],[Benchmark].[Benchmark].&[1],[Rating].[Rating Category].[All],[Currency of Exposure].[Currency].&[2]) CELL PROPERTIES VALUE, FORMATTED_VALUE, FONT_NAME, FONT_SIZE, FONT_FLAGS,FORE_COLOR, BACK_COLOR, FORMAT_STRING

Reporting Services

SELECT NON EMPTY { [Measures].[Duration], [Measures].[Weighting] } ON COLUMNS, NON EMPTY { ([Sector].[Sector Category].[Sector Category].ALLMEMBERS * [Benchmark].[Benchmark].[Benchmark].ALLMEMBERS * [Portfolio].[Portfolio].[Portfolio].ALLMEMBERS * [Scenario].[Scenario].[Scenario].ALLMEMBERS ) } DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS FROM ( SELECT ( { [Scenario].[Scenario].&[1] } ) ON COLUMNS FROM ( SELECT ( { [Rating].[Rating Category].&[38] } ) ON COLUMNS FROM ( SELECT ( { [Benchmark].[Benchmark].&[1] } ) ON COLUMNS FROM ( SELECT ( { [Period].[Year- Month].[Month].&[2006-03-01T00:00:00] } ) ON COLUMNS FROM [MIQB27])))) WHERE ( [Period].[Year- Month].[Month].&[2006-03-01T00:00:00], [Rating].[Rating Category].&[38] ) CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR, FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS

It's hard to say without seeing your cube, but I suspect one reason for the difference is the fact that RS forces you to pivot your queries so that you only have the measures dimension on columns. This means that you have to put all the rest of your dimensions crossjoined on rows, which could potentially mean that the NON EMPTY operation has a lot of tuples to work on. How many members are there in the Sector Category, Benchmark, Portfolio and Scenario attributes?

Does changing the MDX in RS to be something like the following make a difference?

SELECT NON EMPTY { [Measures].[Duration], [Measures].[Weighting] } ON COLUMNS,
NON EMPTY { (
NONEMPTY(
[Sector].[Sector Category].[Sector Category].ALLMEMBERS
, { [Measures].[Duration], [Measures].[Weighting] })
* [Benchmark].[Benchmark].[Benchmark].ALLMEMBERS * [Portfolio].[Portfolio].[Portfolio].ALLMEMBERS *
[Scenario].[Scenario].[Scenario].ALLMEMBERS ) } DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS FROM
( SELECT ( { [Scenario].[Scenario].&[1] } ) ON COLUMNS FROM ( SELECT ( { [Rating].[Rating Category].&[38] } ) ON COLUMNS FROM ( SELECT ( { [Benchmark].[Benchmark].&[1] } ) ON COLUMNS FROM ( SELECT ( { [Period].[Year- Month].[Month].&[2006-03-01T00:00:00] } ) ON COLUMNS FROM [MIQB27])))) WHERE ( [Period].[Year- Month].[Month].&[2006-03-01T00:00:00], [Rating].[Rating Category].&[38] ) CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR, FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS

Chris

|||I have changed the cube slightly - I had one dimension called Benchmark which I removed it only has 3 leaf members and the ALL level. I had the Benchmark code on another dimension as an attribute so I thought I would use this instead. The RS query now worlks very quickly. On the face of it the MDX query looks just as complex (see below). The only thing I canm think of is as Benchmark was an attribute of Portfolio and a dimension in its own right, it might have been doing some Cartesian Product. But even so there were only 3 members.
Anyway, I am glad the issue has gone away - I was beginning to get worried about the use of RS on top of AS.
Regards
Paul

SELECT NON EMPTY { [Measures].[Weighting], [Measures].[Duration] } ON COLUMNS, NON EMPTY { ([Rating].[Rating Category].[Rating Category].ALLMEMBERS * [Sector].[Sector Category].[Sector Category].ALLMEMBERS * [Portfolio].[Benchmark Portfolio].[Portfolio].ALLMEMBERS * [Scenario].[Scenario].[Scenario].ALLMEMBERS ) } DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS FROM ( SELECT ( STRTOSET(@.CurrencyofExposureCurrency, CONSTRAINED) ) ON COLUMNS FROM ( SELECT ( { [Scenario].[Scenario].&[1], [Scenario].[Scenario].&[3] } ) ON COLUMNS FROM ( SELECT ( STRTOSET(@.PortfolioBenchmark, CONSTRAINED) ) ON COLUMNS FROM ( SELECT ( STRTOSET(@.PeriodYearMonth, CONSTRAINED) ) ON COLUMNS FROM [MIQB28])))) WHERE ( IIF( STRTOSET(@.PeriodYearMonth, CONSTRAINED).Count = 1, STRTOSET(@.PeriodYearMonth, CONSTRAINED), [Period].[Year- Month].currentmember ), IIF( STRTOSET(@.PortfolioBenchmark, CONSTRAINED).Count = 1, STRTOSET(@.PortfolioBenchmark, CONSTRAINED), [Portfolio].[Benchmark].currentmember ), IIF( STRTOSET(@.CurrencyofExposureCurrency, CONSTRAINED).Count = 1, STRTOSET(@.CurrencyofExposureCurrency, CONSTRAINED), [Currency of Exposure].[Currency].currentmember ) ) CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR, FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS


|||

I am curious about your table structure. It looks like you are trying to do the same thing I am. Comparing portfolios to benchmarks for various groupings. Are weightings a calculated field? Do you have an overweight/underweight calculation? Do you use a PortfolioBenchmark dimension table or break them out?

Thanks for any help.

MDX queries from Reporting Services

I have been having some issues with generating reports in Reporting

Services off Analysis Services, in that the reports take a very long

time and I have to often kill the queries. They are using 100%CPU. I have then replicated as

closely as possible the report using the Cube Analysis add in for

Excel, and the response is almost instantaneous.

It

seems it is the MDX that Reporting Services is very inefficient

compared to that generated by Cube Analysis. It uses Selects in the From clause to restrict the scope of the query using the Filter parameters. Is this something anyone has come across, and are there any suggestions to get round it? I did try

to paste the Cube Analysis MDX into Reporting Services but the parser

rejected it as invalid.

I attach the comparitive MDX below for reference

Cube Analysis
SELECT

NON EMPTY{Hierarchize({CROSSJOIN({CROSSJOIN({{{[Portfolio].[Benchmark

Portfolio].[All],[Portfolio].[Benchmark Portfolio].[All].children} +

{{[Portfolio].[Benchmark

Portfolio].[Benchmark].&[1].children}}}},{{[Scenario].[Scenario].&[1],[Scenario].[Scenario].&[1].children}

+

{[Scenario].[Scenario].&[3],[Scenario].[Scenario].&[3].children}

+

{[Scenario].[Scenario].[Benchmark],[Scenario].[Scenario].[Benchmark].children}

+ {[Scenario].[Scenario].[Variance to

Benchmark],[Scenario].[Scenario].[Variance to

Benchmark].children}})},{{[Measures].[Duration]} +

{[Measures].[Weighting]}})})} on 0, NON

EMPTY{Hierarchize({{[Sector].[Sector Category].[All],[Sector].[Sector

Category].[All].children}})} on 1 from [MIQB27] where

([Period].[Year-

Month].[Month].&[2006-03-01T00:00:00],[Benchmark].[Benchmark].&[1],[Rating].[Rating

Category].[All],[Currency of Exposure].[Currency].&[2]) CELL

PROPERTIES VALUE, FORMATTED_VALUE, FONT_NAME, FONT_SIZE,

FONT_FLAGS,FORE_COLOR, BACK_COLOR, FORMAT_STRING

Reporting Services

SELECT NON EMPTY

{ [Measures].[Duration], [Measures].[Weighting] } ON

COLUMNS, NON EMPTY { ([Sector].[Sector Category].[Sector

Category].ALLMEMBERS *

[Benchmark].[Benchmark].[Benchmark].ALLMEMBERS

* [Portfolio].[Portfolio].[Portfolio].ALLMEMBERS

* [Scenario].[Scenario].[Scenario].ALLMEMBERS

) } DIMENSION PROPERTIES

MEMBER_CAPTION, MEMBER_UNIQUE_NAME

ON ROWS FROM ( SELECT ( {

[Scenario].[Scenario].&[1] } ) ON COLUMNS FROM ( SELECT ( { [Rating].[Rating Category].&[38] } ) ON COLUMNS FROM ( SELECT ( {

[Benchmark].[Benchmark].&[1] } ) ON COLUMNS FROM ( SELECT ( { [Period].[Year-

Month].[Month].&[2006-03-01T00:00:00] } ) ON

COLUMNS FROM

[MIQB27])))) WHERE ( [Period].[Year-

Month].[Month].&[2006-03-01T00:00:00], [Rating].[Rating Category].&[38]

) CELL PROPERTIES

VALUE, BACK_COLOR,

FORE_COLOR, FORMATTED_VALUE,

FORMAT_STRING, FONT_NAME,

FONT_SIZE, FONT_FLAGS

It's hard to say without seeing your cube, but I suspect one reason for the difference is the fact that RS forces you to pivot your queries so that you only have the measures dimension on columns. This means that you have to put all the rest of your dimensions crossjoined on rows, which could potentially mean that the NON EMPTY operation has a lot of tuples to work on. How many members are there in the Sector Category, Benchmark, Portfolio and Scenario attributes?

Does changing the MDX in RS to be something like the following make a difference?

SELECT NON EMPTY { [Measures].[Duration], [Measures].[Weighting] } ON COLUMNS,
NON EMPTY { (
NONEMPTY(
[Sector].[Sector Category].[Sector Category].ALLMEMBERS
, { [Measures].[Duration], [Measures].[Weighting] })
* [Benchmark].[Benchmark].[Benchmark].ALLMEMBERS * [Portfolio].[Portfolio].[Portfolio].ALLMEMBERS *
[Scenario].[Scenario].[Scenario].ALLMEMBERS ) } DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS FROM
( SELECT ( { [Scenario].[Scenario].&[1] } ) ON COLUMNS FROM ( SELECT ( { [Rating].[Rating Category].&[38] } ) ON COLUMNS FROM ( SELECT ( { [Benchmark].[Benchmark].&[1] } ) ON COLUMNS FROM ( SELECT ( { [Period].[Year- Month].[Month].&[2006-03-01T00:00:00] } ) ON COLUMNS FROM [MIQB27])))) WHERE ( [Period].[Year- Month].[Month].&[2006-03-01T00:00:00], [Rating].[Rating Category].&[38] ) CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR, FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS

Chris

|||I have changed the cube slightly - I had one dimension called Benchmark

which I removed it only has 3 leaf members and the ALL level. I had

the Benchmark code on another dimension as an attribute so I thought I

would use this instead. The RS query now worlks very quickly. On the

face of it the MDX query looks just as complex (see below). The only

thing I canm think of is as Benchmark was an attribute of Portfolio and

a dimension in its own right, it might have been doing some Cartesian

Product. But even so there were only 3 members.

Anyway, I am glad the issue has gone away - I was beginning to get worried about the use of RS on top of AS.

Regards

Paul

SELECT NON EMPTY

{ [Measures].[Weighting], [Measures].[Duration] } ON

COLUMNS, NON EMPTY { ([Rating].[Rating Category].[Rating

Category].ALLMEMBERS * [Sector].[Sector

Category].[Sector Category].ALLMEMBERS *

[Portfolio].[Benchmark Portfolio].[Portfolio].ALLMEMBERS

* [Scenario].[Scenario].[Scenario].ALLMEMBERS

) } DIMENSION PROPERTIES

MEMBER_CAPTION, MEMBER_UNIQUE_NAME

ON ROWS FROM ( SELECT ( STRTOSET(@.CurrencyofExposureCurrency, CONSTRAINED) ) ON COLUMNS FROM ( SELECT ( { [Scenario].[Scenario].&[1],

[Scenario].[Scenario].&[3] } ) ON COLUMNS FROM ( SELECT ( STRTOSET(@.PortfolioBenchmark,

CONSTRAINED) ) ON

COLUMNS FROM ( SELECT ( STRTOSET(@.PeriodYearMonth,

CONSTRAINED) ) ON

COLUMNS FROM

[MIQB28])))) WHERE ( IIF(

STRTOSET(@.PeriodYearMonth, CONSTRAINED).Count =

1, STRTOSET(@.PeriodYearMonth, CONSTRAINED), [Period].[Year- Month].currentmember ), IIF(

STRTOSET(@.PortfolioBenchmark, CONSTRAINED).Count =

1, STRTOSET(@.PortfolioBenchmark, CONSTRAINED), [Portfolio].[Benchmark].currentmember ), IIF(

STRTOSET(@.CurrencyofExposureCurrency, CONSTRAINED).Count =

1, STRTOSET(@.CurrencyofExposureCurrency, CONSTRAINED), [Currency of Exposure].[Currency].currentmember ) ) CELL

PROPERTIES VALUE,

BACK_COLOR, FORE_COLOR,

FORMATTED_VALUE, FORMAT_STRING,

FONT_NAME, FONT_SIZE,

FONT_FLAGS

|||

I am curious about your table structure. It looks like you are trying to do the same thing I am. Comparing portfolios to benchmarks for various groupings. Are weightings a calculated field? Do you have an overweight/underweight calculation? Do you use a PortfolioBenchmark dimension table or break them out?

Thanks for any help.

MDX parameters in Reporting Services 2005

Hello,
I've been trying to create a report using a dataset filled with a MDX query.
That query needs to have parameters (they come from report parameters). I've
done everything, including what is described in msdn2 and still cant get it
to work.
(The problem is not with the query, if i substitute the @.vars with strings
it works!)
Has everyone ever done this?
Thx.You should use the filter area in the Analysis Services query designer and
check the parameter checkbox. The MDX query will contain:
STRTOSET(@.variablename, CONSTRAINED)
And your parameters will need to be member unique names. The MSDN article
might be for SQL 2000 RS and therefore outdated.
--
Brian Welcker
Group Program Manager
Microsoft SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"Fernando Marçal" <FernandoMaral@.discussions.microsoft.com> wrote in message
news:9E0D1946-C659-4FE2-A862-2005743BCFD8@.microsoft.com...
> Hello,
> I've been trying to create a report using a dataset filled with a MDX
> query.
> That query needs to have parameters (they come from report parameters).
> I've
> done everything, including what is described in msdn2 and still cant get
> it
> to work.
> (The problem is not with the query, if i substitute the @.vars with strings
> it works!)
> Has everyone ever done this?
> Thx.|||Hello Brian,
Im not using query designer, i am creating my own query.
Below I provide my previous query and the query with the change you
sugested. It still doensn't work... it gives the following error:
"Parser: The syntax for '=' is incorrect. (Microsoft SQL Server 2005
Analysis Services)"
The query im using is this:
WITH MEMBER [Measures].[Visitas Previstas]
AS '[Measures].[OBJECTIVE]'
SELECT
{[Measures].[Visitas],
[Measures].[Visitas Previstas],
[Measures].[% Real],
[Measures].[% Por Potencial],
[Measures].[% nos VH e H]}
on columns,
{[TEAMS DIM POTENTIAL].[POTENTIAL DESC].[ALL].[NACIONAL],
[TEAMS DIM POTENTIAL].[POTENTIAL DESC].[ALL].[VERY HIGH],
[TEAMS DIM POTENTIAL].[POTENTIAL DESC].[ALL].[HIGH],
[TEAMS DIM POTENTIAL].[POTENTIAL DESC].[ALL].[MEDIUM],
[TEAMS DIM POTENTIAL].[POTENTIAL DESC].[ALL].[LOW],
[TEAMS DIM POTENTIAL].[POTENTIAL DESC].[ALL].[NO POTENTIAL]}
on rows
FROM TEAMS
WHERE CROSSJOIN([TEAMS DIM LINE].[LINE DESC].[@.lines1],
[TEAMS DIM PRODUCT].[PRODUCT DESC].[@.products1],
[TEAMS DIM BRICK].[TEAMS DIM BRICK].[ALL].[@.bricks1])
The query with changes:
WITH MEMBER [Measures].[Visitas Previstas]
AS '[Measures].[OBJECTIVE]'
SELECT
{[Measures].[Visitas],
[Measures].[Visitas Previstas],
[Measures].[% Real],
[Measures].[% Por Potencial],
[Measures].[% nos VH e H]}
on columns,
{[TEAMS DIM POTENTIAL].[POTENTIAL DESC].[ALL].[NACIONAL],
[TEAMS DIM POTENTIAL].[POTENTIAL DESC].[ALL].[VERY HIGH],
[TEAMS DIM POTENTIAL].[POTENTIAL DESC].[ALL].[HIGH],
[TEAMS DIM POTENTIAL].[POTENTIAL DESC].[ALL].[MEDIUM],
[TEAMS DIM POTENTIAL].[POTENTIAL DESC].[ALL].[LOW],
[TEAMS DIM POTENTIAL].[POTENTIAL DESC].[ALL].[NO POTENTIAL]}
on rows
FROM TEAMS
WHERE CROSSJOIN(strtoset(@.lines1,CONSTRAINED),
strtoset(@.products1,CONSTRAINED),
strtoset(@.bricks1,CONSTRAINED))
Thanks for the help... I really need to get this to work...
"Brian Welcker [MSFT]" wrote:
> You should use the filter area in the Analysis Services query designer and
> check the parameter checkbox. The MDX query will contain:
> STRTOSET(@.variablename, CONSTRAINED)
> And your parameters will need to be member unique names. The MSDN article
> might be for SQL 2000 RS and therefore outdated.
> --
> Brian Welcker
> Group Program Manager
> Microsoft SQL Server Reporting Services
> This posting is provided "AS IS" with no warranties, and confers no rights.
> "Fernando Marçal" <FernandoMaral@.discussions.microsoft.com> wrote in message
> news:9E0D1946-C659-4FE2-A862-2005743BCFD8@.microsoft.com...
> > Hello,
> >
> > I've been trying to create a report using a dataset filled with a MDX
> > query.
> > That query needs to have parameters (they come from report parameters).
> > I've
> > done everything, including what is described in msdn2 and still cant get
> > it
> > to work.
> > (The problem is not with the query, if i substitute the @.vars with strings
> > it works!)
> >
> > Has everyone ever done this?
> >
> > Thx.
>
>|||Sorry, forgot to mencion that i must use report parameters (I have cascading
parameters that i must use in the MDX query).
I've defined this parameters before defining the MDX query, and now i want
to use them in the query.
Thanks again.
"Fernando Marçal" wrote:
> Hello Brian,
> Im not using query designer, i am creating my own query.
> Below I provide my previous query and the query with the change you
> sugested. It still doensn't work... it gives the following error:
> "Parser: The syntax for '=' is incorrect. (Microsoft SQL Server 2005
> Analysis Services)"
> The query im using is this:
> WITH MEMBER [Measures].[Visitas Previstas]
> AS '[Measures].[OBJECTIVE]'
> SELECT
> {[Measures].[Visitas],
> [Measures].[Visitas Previstas],
> [Measures].[% Real],
> [Measures].[% Por Potencial],
> [Measures].[% nos VH e H]}
> on columns,
> {[TEAMS DIM POTENTIAL].[POTENTIAL DESC].[ALL].[NACIONAL],
> [TEAMS DIM POTENTIAL].[POTENTIAL DESC].[ALL].[VERY HIGH],
> [TEAMS DIM POTENTIAL].[POTENTIAL DESC].[ALL].[HIGH],
> [TEAMS DIM POTENTIAL].[POTENTIAL DESC].[ALL].[MEDIUM],
> [TEAMS DIM POTENTIAL].[POTENTIAL DESC].[ALL].[LOW],
> [TEAMS DIM POTENTIAL].[POTENTIAL DESC].[ALL].[NO POTENTIAL]}
> on rows
> FROM TEAMS
> WHERE CROSSJOIN([TEAMS DIM LINE].[LINE DESC].[@.lines1],
> [TEAMS DIM PRODUCT].[PRODUCT DESC].[@.products1],
> [TEAMS DIM BRICK].[TEAMS DIM BRICK].[ALL].[@.bricks1])
> The query with changes:
> WITH MEMBER [Measures].[Visitas Previstas]
> AS '[Measures].[OBJECTIVE]'
> SELECT
> {[Measures].[Visitas],
> [Measures].[Visitas Previstas],
> [Measures].[% Real],
> [Measures].[% Por Potencial],
> [Measures].[% nos VH e H]}
> on columns,
> {[TEAMS DIM POTENTIAL].[POTENTIAL DESC].[ALL].[NACIONAL],
> [TEAMS DIM POTENTIAL].[POTENTIAL DESC].[ALL].[VERY HIGH],
> [TEAMS DIM POTENTIAL].[POTENTIAL DESC].[ALL].[HIGH],
> [TEAMS DIM POTENTIAL].[POTENTIAL DESC].[ALL].[MEDIUM],
> [TEAMS DIM POTENTIAL].[POTENTIAL DESC].[ALL].[LOW],
> [TEAMS DIM POTENTIAL].[POTENTIAL DESC].[ALL].[NO POTENTIAL]}
> on rows
> FROM TEAMS
> WHERE CROSSJOIN(strtoset(@.lines1,CONSTRAINED),
> strtoset(@.products1,CONSTRAINED),
> strtoset(@.bricks1,CONSTRAINED))
> Thanks for the help... I really need to get this to work...
>
> "Brian Welcker [MSFT]" wrote:
> > You should use the filter area in the Analysis Services query designer and
> > check the parameter checkbox. The MDX query will contain:
> >
> > STRTOSET(@.variablename, CONSTRAINED)
> >
> > And your parameters will need to be member unique names. The MSDN article
> > might be for SQL 2000 RS and therefore outdated.
> >
> > --
> > Brian Welcker
> > Group Program Manager
> > Microsoft SQL Server Reporting Services
> >
> > This posting is provided "AS IS" with no warranties, and confers no rights.
> >
> > "Fernando Marçal" <FernandoMaral@.discussions.microsoft.com> wrote in message
> > news:9E0D1946-C659-4FE2-A862-2005743BCFD8@.microsoft.com...
> > > Hello,
> > >
> > > I've been trying to create a report using a dataset filled with a MDX
> > > query.
> > > That query needs to have parameters (they come from report parameters).
> > > I've
> > > done everything, including what is described in msdn2 and still cant get
> > > it
> > > to work.
> > > (The problem is not with the query, if i substitute the @.vars with strings
> > > it works!)
> > >
> > > Has everyone ever done this?
> > >
> > > Thx.
> >
> >
> >|||Why do you have an = sign in your query? Don't use an expression for your
query, just type the literal MDX in the MDX window. Ignore the SQL 2000 RS
directions - I would first build the query with the query designer and then
you can hand edit the generated MDX.
--
Brian Welcker
Group Program Manager
Microsoft SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"Fernando Marçal" <FernandoMaral@.discussions.microsoft.com> wrote in message
news:E2AFD1FD-8909-4028-AC86-3592CCCE69C6@.microsoft.com...
> Sorry, forgot to mencion that i must use report parameters (I have
> cascading
> parameters that i must use in the MDX query).
> I've defined this parameters before defining the MDX query, and now i want
> to use them in the query.
> Thanks again.
> "Fernando Marçal" wrote:
>> Hello Brian,
>> Im not using query designer, i am creating my own query.
>> Below I provide my previous query and the query with the change you
>> sugested. It still doensn't work... it gives the following error:
>> "Parser: The syntax for '=' is incorrect. (Microsoft SQL Server 2005
>> Analysis Services)"
>> The query im using is this:
>> WITH MEMBER [Measures].[Visitas Previstas]
>> AS '[Measures].[OBJECTIVE]'
>> SELECT
>> {[Measures].[Visitas],
>> [Measures].[Visitas Previstas],
>> [Measures].[% Real],
>> [Measures].[% Por Potencial],
>> [Measures].[% nos VH e H]}
>> on columns,
>> {[TEAMS DIM POTENTIAL].[POTENTIAL DESC].[ALL].[NACIONAL],
>> [TEAMS DIM POTENTIAL].[POTENTIAL DESC].[ALL].[VERY HIGH],
>> [TEAMS DIM POTENTIAL].[POTENTIAL DESC].[ALL].[HIGH],
>> [TEAMS DIM POTENTIAL].[POTENTIAL DESC].[ALL].[MEDIUM],
>> [TEAMS DIM POTENTIAL].[POTENTIAL DESC].[ALL].[LOW],
>> [TEAMS DIM POTENTIAL].[POTENTIAL DESC].[ALL].[NO POTENTIAL]}
>> on rows
>> FROM TEAMS
>> WHERE CROSSJOIN([TEAMS DIM LINE].[LINE DESC].[@.lines1],
>> [TEAMS DIM PRODUCT].[PRODUCT DESC].[@.products1],
>> [TEAMS DIM BRICK].[TEAMS DIM BRICK].[ALL].[@.bricks1])
>> The query with changes:
>> WITH MEMBER [Measures].[Visitas Previstas]
>> AS '[Measures].[OBJECTIVE]'
>> SELECT
>> {[Measures].[Visitas],
>> [Measures].[Visitas Previstas],
>> [Measures].[% Real],
>> [Measures].[% Por Potencial],
>> [Measures].[% nos VH e H]}
>> on columns,
>> {[TEAMS DIM POTENTIAL].[POTENTIAL DESC].[ALL].[NACIONAL],
>> [TEAMS DIM POTENTIAL].[POTENTIAL DESC].[ALL].[VERY HIGH],
>> [TEAMS DIM POTENTIAL].[POTENTIAL DESC].[ALL].[HIGH],
>> [TEAMS DIM POTENTIAL].[POTENTIAL DESC].[ALL].[MEDIUM],
>> [TEAMS DIM POTENTIAL].[POTENTIAL DESC].[ALL].[LOW],
>> [TEAMS DIM POTENTIAL].[POTENTIAL DESC].[ALL].[NO POTENTIAL]}
>> on rows
>> FROM TEAMS
>> WHERE CROSSJOIN(strtoset(@.lines1,CONSTRAINED),
>> strtoset(@.products1,CONSTRAINED),
>> strtoset(@.bricks1,CONSTRAINED))
>> Thanks for the help... I really need to get this to work...
>>
>> "Brian Welcker [MSFT]" wrote:
>> > You should use the filter area in the Analysis Services query designer
>> > and
>> > check the parameter checkbox. The MDX query will contain:
>> >
>> > STRTOSET(@.variablename, CONSTRAINED)
>> >
>> > And your parameters will need to be member unique names. The MSDN
>> > article
>> > might be for SQL 2000 RS and therefore outdated.
>> >
>> > --
>> > Brian Welcker
>> > Group Program Manager
>> > Microsoft SQL Server Reporting Services
>> >
>> > This posting is provided "AS IS" with no warranties, and confers no
>> > rights.
>> >
>> > "Fernando Marçal" <FernandoMaral@.discussions.microsoft.com> wrote in
>> > message
>> > news:9E0D1946-C659-4FE2-A862-2005743BCFD8@.microsoft.com...
>> > > Hello,
>> > >
>> > > I've been trying to create a report using a dataset filled with a MDX
>> > > query.
>> > > That query needs to have parameters (they come from report
>> > > parameters).
>> > > I've
>> > > done everything, including what is described in msdn2 and still cant
>> > > get
>> > > it
>> > > to work.
>> > > (The problem is not with the query, if i substitute the @.vars with
>> > > strings
>> > > it works!)
>> > >
>> > > Has everyone ever done this?
>> > >
>> > > Thx.
>> >
>> >
>> >|||editing is the problem. I cant change anything in the query, it always gives
the error "An MDX expression was expected. An empty expression was found"
invariably!
PS: The = sign didnt come from the query but from the parameters I was
referencing in the query parameters window.
"Brian Welcker [MSFT]" wrote:
> Why do you have an = sign in your query? Don't use an expression for your
> query, just type the literal MDX in the MDX window. Ignore the SQL 2000 RS
> directions - I would first build the query with the query designer and then
> you can hand edit the generated MDX.
> --
> Brian Welcker
> Group Program Manager
> Microsoft SQL Server Reporting Services
> This posting is provided "AS IS" with no warranties, and confers no rights.
> "Fernando Marçal" <FernandoMaral@.discussions.microsoft.com> wrote in message
> news:E2AFD1FD-8909-4028-AC86-3592CCCE69C6@.microsoft.com...
> > Sorry, forgot to mencion that i must use report parameters (I have
> > cascading
> > parameters that i must use in the MDX query).
> >
> > I've defined this parameters before defining the MDX query, and now i want
> > to use them in the query.
> >
> > Thanks again.
> >
> > "Fernando Marçal" wrote:
> >
> >> Hello Brian,
> >>
> >> Im not using query designer, i am creating my own query.
> >>
> >> Below I provide my previous query and the query with the change you
> >> sugested. It still doensn't work... it gives the following error:
> >>
> >> "Parser: The syntax for '=' is incorrect. (Microsoft SQL Server 2005
> >> Analysis Services)"
> >>
> >> The query im using is this:
> >>
> >> WITH MEMBER [Measures].[Visitas Previstas]
> >> AS '[Measures].[OBJECTIVE]'
> >> SELECT
> >> {[Measures].[Visitas],
> >> [Measures].[Visitas Previstas],
> >> [Measures].[% Real],
> >> [Measures].[% Por Potencial],
> >> [Measures].[% nos VH e H]}
> >> on columns,
> >> {[TEAMS DIM POTENTIAL].[POTENTIAL DESC].[ALL].[NACIONAL],
> >> [TEAMS DIM POTENTIAL].[POTENTIAL DESC].[ALL].[VERY HIGH],
> >> [TEAMS DIM POTENTIAL].[POTENTIAL DESC].[ALL].[HIGH],
> >> [TEAMS DIM POTENTIAL].[POTENTIAL DESC].[ALL].[MEDIUM],
> >> [TEAMS DIM POTENTIAL].[POTENTIAL DESC].[ALL].[LOW],
> >> [TEAMS DIM POTENTIAL].[POTENTIAL DESC].[ALL].[NO POTENTIAL]}
> >> on rows
> >> FROM TEAMS
> >> WHERE CROSSJOIN([TEAMS DIM LINE].[LINE DESC].[@.lines1],
> >> [TEAMS DIM PRODUCT].[PRODUCT DESC].[@.products1],
> >> [TEAMS DIM BRICK].[TEAMS DIM BRICK].[ALL].[@.bricks1])
> >>
> >> The query with changes:
> >>
> >> WITH MEMBER [Measures].[Visitas Previstas]
> >> AS '[Measures].[OBJECTIVE]'
> >> SELECT
> >> {[Measures].[Visitas],
> >> [Measures].[Visitas Previstas],
> >> [Measures].[% Real],
> >> [Measures].[% Por Potencial],
> >> [Measures].[% nos VH e H]}
> >> on columns,
> >> {[TEAMS DIM POTENTIAL].[POTENTIAL DESC].[ALL].[NACIONAL],
> >> [TEAMS DIM POTENTIAL].[POTENTIAL DESC].[ALL].[VERY HIGH],
> >> [TEAMS DIM POTENTIAL].[POTENTIAL DESC].[ALL].[HIGH],
> >> [TEAMS DIM POTENTIAL].[POTENTIAL DESC].[ALL].[MEDIUM],
> >> [TEAMS DIM POTENTIAL].[POTENTIAL DESC].[ALL].[LOW],
> >> [TEAMS DIM POTENTIAL].[POTENTIAL DESC].[ALL].[NO POTENTIAL]}
> >> on rows
> >> FROM TEAMS
> >> WHERE CROSSJOIN(strtoset(@.lines1,CONSTRAINED),
> >> strtoset(@.products1,CONSTRAINED),
> >> strtoset(@.bricks1,CONSTRAINED))
> >>
> >> Thanks for the help... I really need to get this to work...
> >>
> >>
> >>
> >> "Brian Welcker [MSFT]" wrote:
> >>
> >> > You should use the filter area in the Analysis Services query designer
> >> > and
> >> > check the parameter checkbox. The MDX query will contain:
> >> >
> >> > STRTOSET(@.variablename, CONSTRAINED)
> >> >
> >> > And your parameters will need to be member unique names. The MSDN
> >> > article
> >> > might be for SQL 2000 RS and therefore outdated.
> >> >
> >> > --
> >> > Brian Welcker
> >> > Group Program Manager
> >> > Microsoft SQL Server Reporting Services
> >> >
> >> > This posting is provided "AS IS" with no warranties, and confers no
> >> > rights.
> >> >
> >> > "Fernando Marçal" <FernandoMaral@.discussions.microsoft.com> wrote in
> >> > message
> >> > news:9E0D1946-C659-4FE2-A862-2005743BCFD8@.microsoft.com...
> >> > > Hello,
> >> > >
> >> > > I've been trying to create a report using a dataset filled with a MDX
> >> > > query.
> >> > > That query needs to have parameters (they come from report
> >> > > parameters).
> >> > > I've
> >> > > done everything, including what is described in msdn2 and still cant
> >> > > get
> >> > > it
> >> > > to work.
> >> > > (The problem is not with the query, if i substitute the @.vars with
> >> > > strings
> >> > > it works!)
> >> > >
> >> > > Has everyone ever done this?
> >> > >
> >> > > Thx.
> >> >
> >> >
> >> >
>
>

Monday, February 20, 2012

MDX Parameter query

I have a Timesheet cube and I am reporting against it in Reporting
Services.
I have a parameter called FromParam in the report and I want to use the
following
MDX Query for the parameter:
select {[Period].[Period].Members} on rows , {} on columns from
Timesheet
All I want is a list of periods on rows I do not want anything on
columns please help me when I run this query I get a message:
Unable to display opened cellset. Cells cannot be created for this
cellset because one of the axes contains no positions.
All I want is a one axis query.
Thanks
Karenselect {[Period].[Period].Members} on axis(0)
from [Timesheet]
"KarenM" <karenmiddleol@.yahoo.com> wrote in message
news:1158930431.269312.221390@.e3g2000cwe.googlegroups.com...
>I have a Timesheet cube and I am reporting against it in Reporting
> Services.
> I have a parameter called FromParam in the report and I want to use the
> following
> MDX Query for the parameter:
> select {[Period].[Period].Members} on rows , {} on columns from
> Timesheet
> All I want is a list of periods on rows I do not want anything on
> columns please help me when I run this query I get a message:
> Unable to display opened cellset. Cells cannot be created for this
> cellset because one of the axes contains no positions.
> All I want is a one axis query.
> Thanks
> Karen
>