SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Reporting Services: Read Data from SSAS and SQL Server in One Dataset


Reporting Services: Read Data from SSAS and SQL Server in One Dataset

Author
Message
ejaluronaldlee
ejaluronaldlee
Forum Newbie
Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)

Group: General Forum Members
Points: 6 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
Martin Cremer
Martin Cremer
SSC-Enthusiastic
SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)

Group: General Forum Members
Points: 178 Visits: 80
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
Rick-153145
Rick-153145
SSC Veteran
SSC Veteran (214 reputation)SSC Veteran (214 reputation)SSC Veteran (214 reputation)SSC Veteran (214 reputation)SSC Veteran (214 reputation)SSC Veteran (214 reputation)SSC Veteran (214 reputation)SSC Veteran (214 reputation)

Group: General Forum Members
Points: 214 Visits: 356
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


Martin Cremer
Martin Cremer
SSC-Enthusiastic
SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)

Group: General Forum Members
Points: 178 Visits: 80
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
Rick-153145
Rick-153145
SSC Veteran
SSC Veteran (214 reputation)SSC Veteran (214 reputation)SSC Veteran (214 reputation)SSC Veteran (214 reputation)SSC Veteran (214 reputation)SSC Veteran (214 reputation)SSC Veteran (214 reputation)SSC Veteran (214 reputation)

Group: General Forum Members
Points: 214 Visits: 356
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.
Martin Cremer
Martin Cremer
SSC-Enthusiastic
SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)SSC-Enthusiastic (178 reputation)

Group: General Forum Members
Points: 178 Visits: 80
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
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search