Showing posts with label cube. Show all posts
Showing posts with label cube. Show all posts

Friday, March 30, 2012

MULTIPLE INTERSECT in MDX Query - Reg

Hi Everyone,

We are facing some problem in the cube particularly in INTERSECT function.

Here are the details.

Dimension Tables:

DimTime 200601

200602

DimProduct 01

02

DimUser 101

102

103

FactTables:

FactPlayer

Time Product User

200601 01 101

200601 02 101

200601 01 102

Transact SQL Query:

Select Count(*) from

(

Select userid from FactPlayer where productId = 01

INTERSECT

Select userid from FactPlayer where productId= 02

)

PlayerCount

We want the same result from MDX query. Can you please guide us how to do it by using INTERSECT.

Expecting your valuable reply.

Regards

Vijay


Hi Vijay,

You could solve this using the Intersect function, but you don't need to. Here's an example from Adventure Works showing all the Customers who bought products from two different subcategories (mountain bikes and caps):

select {[Measures].[Internet Sales Amount]} on 0,
nonempty(
nonempty(
[Customer].[Customer].[Customer].members,
([Measures].[Internet Sales Amount], [Product].[Subcategory].&[1])
)
, ([Measures].[Internet Sales Amount],[Product].[Subcategory].&[19])
)
on 1
from [Adventure Works]

What it's doing is using the nonempty function to return a list of Customers who bought products in subcategory 1, and then using another nonempty function to filter that list by those who bought products from subcategory 19. This, I think, will be more efficient than using the Intersect function although for the record here's the same query rewritten to use Intersect:

select {[Measures].[Internet Sales Amount]} on 0,
intersect(
nonempty(
[Customer].[Customer].[Customer].members,
([Measures].[Internet Sales Amount], [Product].[Subcategory].&[1])
)
,nonempty(
[Customer].[Customer].[Customer].members,
([Measures].[Internet Sales Amount],[Product].[Subcategory].&[19])
)
)
on 1
from [Adventure Works]

HTH,

Chris

|||

Hi Chris,

Thank you very much. It is working perfectly.

Vijay

|||

Hi Everyone,

We are facing some problem in the cube particularly in INTERSECT function.

Here are the details.

Dimension Tables:

DimTime 200601

200602

DimProduct 01

02

03

DimUser 101

102

FactTables:

FactPlayer

Time Product User

200601 01 101

200601 02 101

200601 01 102

200601 03 101

Transact SQL Query:

Select Count(*) from

(

Select user from FactPlayer where productId = 01

INTERSECT

Select user from FactPlayer where productId= 02

INTERSECT

Select user from FactPlayer where productId= 03

)

PlayerCount

RESULT: 1 (UserId: 101)

We want the same result from MDX query. Can you please guide us how to do it by using INTERSECT.

Expecting your valuable reply.

Regards

Vijay

|||

I found the solution below.

SELECT NON EMPTY{[Measures].[User ID Distinct Count]} ON COLUMNS,

INTERSECT

(

NONEMPTY

(

INTERSECT

(

NONEMPTY

(

[DIM USER].[DIM USER].CHILDREN,

([Dim Time].[TimeKey].&[200602],

[Measures].[User ID Distinct Count],

[DIM PRODUCT].[DIM PRODUCT].&[3])

),

NONEMPTY

(

[DIM USER].[DIM USER].CHILDREN,

([Dim Time].[TimeKey].&[200602],

[Measures].[User ID Distinct Count],

[DIM PRODUCT].[DIM PRODUCT].&[11])

)

)

),

NONEMPTY

(

[DIM USER].[DIM USER].CHILDREN,

([Dim Time].[TimeKey].&[200602],

[Measures].[User ID Distinct Count],

[DIM PRODUCT].[DIM PRODUCT].&[12])

)

)

ON ROWS

FROM [DSV KPI]

Please reply me if there any changes in the query.

Thank You

Vijay

sql

Wednesday, March 21, 2012

Multiple Fact Tables

I have two fact tables in a cube...Both fact tables have plenty of measures, some even have the same measures but are name differently (ex. Bad Phone Number, Number of Bad Phones). When I process the cube, only the measures in the most recent fact table (A) show up. The oldest fact table does have some measures to show up in the cube but I was expecting that all the measure in both fact tables would show up. Both fact tables are connected to the same dimensions. Any ideas?

So when you open up the cube in BIDS, can you see all the measures you expect in the list on the top left hand side? If not you can drag the columns you want from the fact tables in the diagram in the centre pane to the measures list. If you cannot even see these columns in the diagram then you must have altered your table structures after building your DSV and you will need to open up your DSV and refresh it before going back into the cube designer to create the measures.

Hope this helps.

|||

Darren, thanks a bunch this worked

Monday, March 19, 2012

Multiple datasource for a grid

Hello,
I have a report specification with a simple grid with 4 indicators and an
dimension on rows
Indicator 1,2 and 3 are coming from a cube so i retrive the data with a MDX
query
The last indicator come from a SQL Server (2k5) database in another system.
Today we have a set a reports on the cube and a set of reports on the SQL
darabase.
Can i make this kind of reports with 2 datasources in Reporting services
(2k5)?
Regards,
NicolasMaybe. I haven't done this with a cube but I have done it with relational
data. The concern I have is less where the data is coming from but whether
or not you are using a table control or a matrix to show the data. If a
table control I know it will work.Create a sub report (a sub report is just
a regular report with a parameter you will use to tie the sub report to the
base report). Test the sub report (going agains the SQL data).
Create an extra cell in the row on the table grid. Drag and drop the sub
report onto the cell. Do a right mouse click on the sub report and map the
parameter to the appropriate field.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Nicolas Lievain" <n.lievain@.bravosolution.fr> wrote in message
news:OvKBy0efIHA.5348@.TK2MSFTNGP03.phx.gbl...
> Hello,
> I have a report specification with a simple grid with 4 indicators and an
> dimension on rows
> Indicator 1,2 and 3 are coming from a cube so i retrive the data with a
> MDX query
> The last indicator come from a SQL Server (2k5) database in another
> system.
> Today we have a set a reports on the cube and a set of reports on the SQL
> darabase.
> Can i make this kind of reports with 2 datasources in Reporting services
> (2k5)?
> Regards,
> Nicolas
>

Friday, March 9, 2012

Multiple data sources, single cube?

Newbie question...

I need to create a report with data coming from two entirely separate data sources, the only common factor being the date.

I can see that I could create a single DSV and cube by using views to point to the second database. But is it considered best practice to create a second cube and join the cubes with MDX?

Thanks

This is not so much of a technical question as a how you solve these problems generally. If there is a point of joining information in separate sources you should do it, not in the cubes, but in a data warehouse.

These integration problems should be handled in extract-, transfer-, load processes before you build a cube.

Have a look here(http://www.kimballgroup.com/) for support and ideas.

HTH

Thomas Ivarsson

|||

Thanks Thomas,

That ties in with advice from the Project REAL docs too.