Friday, March 9, 2012

please............ need urgent help on mdx parameter passing


i need to pass parameter to quarter and the year. dnt knw how to pass the it using strtoset. ?
please help me

WITH

SET [FilteredBUSet] AS strtoset(@.Paramater5,constrained)
SET [FilteredAccountSet] AS '[Account—BUSegmentBCDsc].[Billing Code Description].members'

SET [CustomTimeSet] AS 'Descendants([Date—Fiscal].[All Date—Fiscal].[2005].[Quarter 1]:
[Date—Fiscal].[All Date—Fiscal].[2006].[Quarter 2],[Date—Fiscal].[month],Leaves)'

SELECT
nonempty (CROSSJOIN([CustomTimeSet],INTERSECT([FilteredBUSet],[FilteredAccountSet])))ON ROWS,
{[Measures].[Total Revenue],[Measures].[Total Expenses]} ON COLUMNS
FROM Profitability

Well I feel that you should make Members in place of Set. But Still you can test your code as following...

You want to pass the set in peramater type STRTOSET('{....Type your Peramater Set here and then run your code.....}',constrained)

and see your query is ok or not other wise make calculated Members in place of Set and then check your code.

WITH

SET [FilteredBUSet] AS

STRTOSET('{........}',constrained)

SET [FilteredAccountSet] AS

'[Account—BUSegmentBCDsc].[Billing Code Description].members'

SET [CustomTimeSet] AS

'Descendants([Date—Fiscal].[All Date—Fiscal].[2005].[Quarter 1]:

[Date—Fiscal].[All Date—Fiscal].[2006].[Quarter 2],[Date—Fiscal].[month],Leaves)'

SELECT

NON EMPTY (

CROSSJOIN(

[CustomTimeSet],

INTERSECT([FilteredBUSet],[FilteredAccountSet])))ON ROWS,

{

[Measures].[Total Revenue],

[Measures].[Total Expenses]

} ON COLUMNS

FROM Profitability

Bhudev

|||still has some errors. problem is how to pass the parameter to the customtimeset
|||

Wick here I'm sending you one of my MDX Sample Query in which I'm using the parameters, by looking this I feel you may go ahead....

WITH

MEMBER [Measures].[EPUS] AS

CASE

WHEN StrToValue(@.EPUS) = 1 AND StrToValue(@.Production) = 1 THEN {[Measures].[Measure 1]}

WHEN StrToValue(@.EPUS) = 2 AND StrToValue(@.Production) = 1 THEN {[Measures].[Measure 2]}

WHEN StrToValue(@.EPUS) = 3 AND StrToValue(@.Production) = 1 THEN {[Measures].[Measure 3]}

WHEN StrToValue(@.EPUS) = 4 AND StrToValue(@.Production) = 1 THEN {[Measures].[Measure 4]}

WHEN StrToValue(@.EPUS) = 5 AND StrToValue(@.Production) = 1 THEN {[Measures].[Measure 5]}

WHEN StrToValue(@.EPUS) = 6 AND StrToValue(@.Production) = 1 THEN {[Measures].[Measure 6]}

WHEN StrToValue(@.EPUS) = 7 AND StrToValue(@.Production) = 1 THEN {[Measures].[Measure 7]}

WHEN StrToValue(@.EPUS) = 8 AND StrToValue(@.Production) = 1 THEN {[Measures].[Measure 8]}

WHEN StrToValue(@.EPUS) = 9 AND StrToValue(@.Production) = 1 THEN {[Measures].[Measure 9]}

WHEN StrToValue(@.EPUS) = 1 AND StrToValue(@.Production) = 2 THEN {[Measures].[Measure 10]}

WHEN StrToValue(@.EPUS) = 2 AND StrToValue(@.Production) = 2 THEN {[Measures].[Measure 11]}

WHEN StrToValue(@.EPUS) = 3 AND StrToValue(@.Production) = 2 THEN {[Measures].[Measure 12]}

WHEN StrToValue(@.EPUS) = 4 AND StrToValue(@.Production) = 2 THEN {[Measures].[Measure 13]}

WHEN StrToValue(@.EPUS) = 5 AND StrToValue(@.Production) = 2 THEN {[Measures].[Measure 14]}

WHEN StrToValue(@.EPUS) = 6 AND StrToValue(@.Production) = 2 THEN {[Measures].[Measure 15]}

WHEN StrToValue(@.EPUS) = 7 AND StrToValue(@.Production) = 2 THEN {[Measures].[Measure 16]}

WHEN StrToValue(@.EPUS) = 8 AND StrToValue(@.Production) = 2 THEN {[Measures].[Measure 17]}

WHEN StrToValue(@.EPUS) = 9 AND StrToValue(@.Production) = 2 THEN {[Measures].[Measure 18]}

END

SELECT

NON EMPTY {

STRTOSET(@.MISRange)

} ON 1,

NON EMPTY {

[Measures].[EPUS]

} ON 0

FROM (SELECT(STRTOSET(@.Customer,CONSTRAINED)) ON COLUMNS

FROM (SELECT(STRTOSET(@.UnitModel,CONSTRAINED)) ON COLUMNS

FROM (SELECT(STRTOSET(@.Country,CONSTRAINED)) ON COLUMNS

FROM (SELECT(STRTOSET(@.TimeProduction)) ON COLUMNS

FROM [My Cube]))))

Here I will pass [Time Production].[Time Calendar].[FY 2007] for @.TimeProduction

Bhudev

|||can u tell me the error of the following query? if there is error pls correct it. coz it has some errors. trying to pass the parameter to customtimeset

WITH

SET [FilteredBUSet] AS strtoset(@.BU)
SET [FilteredAccountSet] AS strtoset(@.Account)
SET [FParamYear] AS strtoset(@.FYear)
SET [FParamQuarter] AS strtoset(@.FQuarter)
SET [TParamYear] AS strtoset(@.TYear)
SET [TParamQuarter] AS strtoset(@.TQuarter)

SET [CustomTimeSet] AS Descendants([Date—Fiscal].[All Date—Fiscal].[FParamYear].[FParamQuarter]:
[Date—Fiscal].[All Date—Fiscal].[TParamYear].[TParamQuarter],[Date—Fiscal].[month],Leaves)

SELECT

{[Measures].[Total Revenue],[Measures].[Total Expenses]} ON COLUMNS ,
[CustomTimeSet] ON ROWS
--[Date—Fiscal].[All Date—Fiscal].[2006].[Quarter 1] on rows
FROM Profitability
|||You can't use sets in the unique name reference in the way you have. See my answer on your other thread https://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1824709&SiteID=1|||

Hi,

Code looks fine, but what values you are passing for paramaters. can I know? I'm displaying the Sample values passed by me in my enviorment and it is working fine.

What Error Message you are getting. Have you tried without CONSTRAINT. Are you passing rite values....

Well I need to know what you are passing for @.Paramater5 and @.Quarter.

WITH

SET [FilteredBUSet] AS

STRTOSET('{[Customer].[Customer Name].&[1]}') --> @.Paramater5

SET [FilteredAccountSet] AS

'[Customer].[Customer Name].Members'

SET [CustomTimeSet] AS

DESCENDANTS(

STRTOMEMBER('[Time Production].[Time Calendar]'), --> @.Quarter

[Time Production].[Time Calendar].[Quarter],

LEAVES)

SELECT

NON EMPTY (

CROSSJOIN(

[CustomTimeSet],

INTERSECT([FilteredBUSet],[FilteredAccountSet]))) ON ROWS,

{

[Measures].[Total Revenue],

[Measures].[Total Expenses]

} ON COLUMNS

FROM [Profitability]

Bhudev

No comments:

Post a Comment