A. Set a linked server (analysis server) in your SQL Server
In the SQL Server Surface Area Configuration enable 'Ad Hoc Remote Queries'
1. Open SQL Surface Area configuration
2. Go to Database enginer --> Ad Hoc Remote Queries --> Set Enable OPENROWSER andn OPENDATASOURCE support
In SQL Mgmt Studio in Server Objects to the MSOLAP Linked Server provider to 'Allow inprocess'
B. Write Stored procedure :
1. Create a parameterized stored procedure to return a flat table from the Analysis Services cube. I will explain the process of setting this in the demo session.
CREATE
(
AS
SalesTerritoryGroup
SalesAmount
OrderQuantity
TotalProductCost
OrderQuantity)
SELECT * FROM OPENQUERY(ADVWORKS_SSAS,
''SELECT NON EMPTY { [Measures].[Internet Sales Amount], [Measures].[Internet Order Quantity]}
ON COLUMNS,
NON EMPTY { ([Sales Reason].[Sales Reason].[Sales Reason].ALLMEMBERS *
[Sales Territory].[Sales Territory Group].[Sales Territory Group].ALLMEMBERS ) }
having [Measures].[Internet Sales Amount] '
FROM [Adventure Works]
WHERE ([Product].[Category].&['
C. Report setttings
2. Use this SP as the Data Source in your server report
3. Create the required parameters in the report
4. Set the report parameters in the winform application based on the value provided by the end user. I have not used operator parameter as of now. However, after the demo you will find it easy to implement.
rp[0].Name = "ProductCategoryID";
rp[1].Name = "MeasureValue";
rp[0].Values.Add(txtCategoryId.Text.Trim());
rp[1].Values.Add(txtMeasureValue.Text.Trim());
5. Run the winForm app. Pass the parameters in the textboxes and show the report
Final screen: