简体   繁体   中英

Parameterize MDX in SSRS

Relatively new to MDX but familiar with SSRS and I have a query that works just as I want it to in the query designer in SSMS however I'm not quite sure how to parameterize this in SSRS.

Query returns department and shift as dimensions and Hours and Period as Measures with the query being filtered by a fiscal year and the Period measure as a specific period for that year.

Query works as expected but do not know how to convert to SSRS by implementing parameters for Fiscal Period and Fiscal Year.

Query:

WITH MEMBER [measures].[Period] AS 
SUM([Date].[Fiscal Period].[P9],[Measures].[Hours])

SELECT NON EMPTY [Department].[Department].[Department] * [Associate].[Current Shift].[Current Shift] on Rows,
{[Measures].[Hours], [Measures].[Period]} ON Columns
FROM Personnel
WHERE [Date].[Fiscal Year].[FY2015]

Create two parameters for Fiscal year and Fiscal Period. Then use the below query:

SELECT NON EMPTY [Department].[Department].[Department] * [Associate].[Current Shift].[Current Shift] on Rows,
[Measures].[Hours] ON Columns
FROM Personnel
WHERE 

(
 StrToMember(@FiscalYear, CONSTRAINED), 
 StrToMember(@FiscalPeriod, CONSTRAINED)
)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM