Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

Reporting Services: Read Data from SSAS and SQL Server in One Dataset Expand / Collapse
Author
Message
Posted Tuesday, April 26, 2011 9:38 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, June 20, 2011 9:06 AM
Points: 2, Visits: 12
Assuming that I have multiple cubes I am reading from SQL Server Analysis Services.

All my cubes have the same names.

Is the way I can create a report that spans across multiple cubes or merge all the cubes' calculations.

Thanks,

Ron
Post #1098738
Posted Tuesday, April 26, 2011 2:51 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Friday, December 2, 2011 12:11 AM
Points: 125, Visits: 77
Hi Ron,

you can use the approach shown in this article to create a report which gets its content from more than one cubes:

For example you have one mdx which retrieves the number of invoices per customer. You can write the results into a temp-table with the technique shown in the article.
Then you have another mdx from another cube (which then is another linked server) which gets the number of visits on your homepage per customer. Write this into another temp-table.

Then you can (inner/outer) join these tables as you like (now we are in normal SQL environment again, where we can do whatever we like with the data).

If the cubes are in the same database, have a look at the lookupcube-mdx function (s. http://msdn.microsoft.com/en-us/library/ms144720.aspx). This also could solve your problem.

Hope that helped.

Martin
Post #1099058
Posted Friday, November 18, 2011 6:24 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Thursday, August 14, 2014 1:04 AM
Points: 178, Visits: 291
Thanks, nice article.

I have one issue of my own though and can't find a way around it. I have 3 mdx statements I am joining using openquery, setting a variable and then using sp_executesql to run it. The problem I have is when say the third join is empty, the whole thing comes back as empty. I am setting values on the fly (there are far more vatriables than posted here) and therefore can not simply execute with OPENQUERY into a #temp table and then check for existance of the columns (I am seriously starting to fall out with OPENQUERY).

What I need is if there are no results from the third query, to still return the National and Regional results (there are still results) without having to re-execute the whole thing in a nested try/catch. Can anyone think of a novel way to do this as hitting major walls at the moment?

SET @SQL = 'SELECT 
Series
, RegionName
, OrgName
, NationalTurn
, CONVERT(DECIMAL(18,2),NationalPercent * 100.0000) AS NationalPercent
, RegionalTurn
, CONVERT(DECIMAL(18,2),RegionalPercent * 100.0000) AS RegionalPercent
, DLRTurn
, CONVERT(DECIMAL(18,2),DLRPercent * 100.0000) AS DLRPercent
FROM
(
SELECT
CONVERT(VARCHAR,NationalTurn."[ModelDesc].[Series].[Series].[MEMBER_CAPTION]") AS Series
, CONVERT(VARCHAR,RegionalTurn."[DealerInformation].[Region Name].[Region Name].[MEMBER_CAPTION]") AS RegionName
, CONVERT(VARCHAR,DLRTurn."[DealerInformation].[Organisation Name].[Organisation Name].[MEMBER_CAPTION]") AS OrgName
, CAST(CONVERT(FLOAT,NationalTurn."[Measures].[Turn(Months)]") AS DECIMAL(18,2) ) AS NationalTurn
, CAST(CONVERT(FLOAT,NationalTurn."[Measures].[NationalMixPercent]") AS DECIMAL(18,5) ) AS NationalPercent
, CAST(CONVERT(FLOAT,RegionalTurn."[Measures].[Turn(Months)]") AS DECIMAL(18,2) ) AS RegionalTurn
, CAST(CONVERT(FLOAT,RegionalTurn."[Measures].[RegionalMixPercent]") AS DECIMAL(18,5) ) AS RegionalPercent
, CAST(CONVERT(FLOAT,DLRTurn."[Measures].[Turn(Months)]") AS DECIMAL(18,2) ) AS DLRTurn
, CAST(CONVERT(FLOAT,DLRTurn."[Measures].[DLRMixPercent]") AS DECIMAL(18,5) ) AS DLRPercent
FROM
OPENQUERY(MSOLAPSRV,''SELECT
{ [Measures].[Turn(Months)] , [Measures].[NationalMixPercent] } ON COLUMNS
, NONEMPTY( { ([ModelDesc].[Series].[' + @Series + '] ) },
{ [Measures].[Turn(Months)] , [Measures].[NationalMixPercent] }) ON ROWS
FROM
[cube]
WHERE
([StockApplication].[PWD App ID].[' + @AppID + '])
''
) NationalTurn
INNER JOIN
OPENQUERY(MSOLAPSRV,''SELECT
{ [Measures].[Turn(Months)] , [Measures].[RegionalMixPercent] } ON COLUMNS
, NONEMPTY( { ([ModelDesc].[Series].[' + @Series + '] , [DealerInformation].[Region Name].[' + @Region + ']) } ,
{ [Measures].[Turn(Months)] , [Measures].[RegionalMixPercent] }) ON ROWS
FROM
[cube]
WHERE
([StockApplication].[PWD App ID].[' + @AppID + '])
''
) RegionalTurn
ON
CONVERT(VARCHAR,NationalTurn."[ModelDesc].[Series].[Series].[MEMBER_CAPTION]") = CONVERT(VARCHAR,RegionalTurn."[ModelDesc].[Series].[Series].[MEMBER_CAPTION]")
INNER JOIN
OPENQUERY(MSOLAPSRV,''SELECT
{ [Measures].[Turn(Months)] , [Measures].[DLRMixPercent] } ON COLUMNS
, NONEMPTY( { ([ModelDesc].[Series].[' + @Series + '] , [DealerInformation].[Region Name].[' + @Region + '] , [DealerInformation].[Organisation ID].[' + @Dealer + '] )},
{ [Measures].[Turn(Months)] , [Measures].[DLRMixPercent] }) ON ROWS
FROM
[cube]
WHERE
([StockApplication].[PWD App ID].[' + @AppID + '])
''
) DLRTurn
ON
CONVERT(VARCHAR,NationalTurn."[ModelDesc].[Series].[Series].[MEMBER_CAPTION]") = CONVERT(VARCHAR,DLRTurn."[ModelDesc].[Series].[Series].[MEMBER_CAPTION]")
AND
CONVERT(VARCHAR,RegionalTurn."[DealerInformation].[Region Name].[Region Name].[MEMBER_CAPTION]") = CONVERT(VARCHAR,DLRTurn."[DealerInformation].[Region Name].[Region Name].[MEMBER_CAPTION]")
) tblCube'

EXEC sp_executesql @SQL

Post #1208302
Posted Saturday, November 19, 2011 5:36 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Friday, December 2, 2011 12:11 AM
Points: 125, Visits: 77
Rick,

Maybe I get your question wrong, but wouldn't it help to do a left join to the last query, so it would return the results of the first two queries even if there are no results of the third query?

Hope this helps
Martin
Post #1208791
Posted Saturday, November 19, 2011 7:40 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Thursday, August 14, 2014 1:04 AM
Points: 178, Visits: 291
Martin Cremer (11/19/2011)
Rick,

Maybe I get your question wrong, but wouldn't it help to do a left join to the last query, so it would return the results of the first two queries even if there are no results of the third query?

Hope this helps
Martin

It would be great if a left join would work, but because the field doesn't exist (the [DealerInformation].[Organisation ID].[Organisation ID].[MEMBER_CAPTION]) it still errors.
Post #1208802
Posted Sunday, November 27, 2011 10:42 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Friday, December 2, 2011 12:11 AM
Points: 125, Visits: 77
Hi Rick,

sorry, I hadn't thought of that problem.

I have one idea which might work. You could build your 3rd mdx in such a way that it always returns at least one record (for example by including the all member of some dimension in your WHERE-clause).
Of course your final SELECT should not return this record. But this could be achieved by defining the correct ON-clause in the join.

I hope this helps.

Take care
Martin
Post #1212220
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse