Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MDX query trouble, need SQL type WHERE 1

Status
Not open for further replies.

FhHouse

Programmer
May 28, 2001
16
0
0
US
I have only done basic queries using MDX and now I am in a spot of trouble. I am trying to query data from a cube and want the data returned to be based on elements that do not appear in the result set. I have made a similar query against the Foodmart cube.

This one works
SELECT
{
[Store].[USA].[CA], [Store].[USA].[OR], [Store].[USA].[WA]
}
ON COLUMNS,
{
[Time].[1997]
}
ON ROWS
FROM Sales
WHERE (
[Measures].[Profit],
[Product].[Food].[Baking Goods].[Jams and Jellies].[Jam].[Super]
)

But what I want to do is have the where clause filter by more than [Jam].[Super], I would like to roll up the filter to include multiples i.e [Jam].[Plato], [Jam].[Super], [Jam].[CDR], in SQL I could just use WHERE Brand IN (Plato, Super, CDR) But I know the where statement works in a diffent way in MDX. From what i have read in msdn articles this should work but it throws the error

'cannot convert set to tuple in the - { } function'

SELECT
{
[Store].[USA].[CA], [Store].[USA].[OR], [Store].[USA].[WA]
}
ON COLUMNS,
{
[Time].[1997]
}
ON ROWS
FROM Sales
WHERE
{
([Measures].[Profit],
[Product].[Food].[Baking Goods].[Jams and Jellies].[Jam].[Super]),
([Measures].[Profit],
[Product].[Food].[Baking Goods].[Jams and Jellies].[Jam].[Plato])
}

This may be caused because I am including the measure in the where clause? This where i need the measure data.

Can anyone help me with this?
I would really appreciate it.
 
I found out how, if any one cares

I needed to use the Aggregate() function

WITH Member [Product].[myAgg] AS
'Aggregate
( {
[Product].[Food].[Baking Goods].[Jams and Jellies].[Jam].[Super],
[Product].[Food].[Baking Goods].[Jams and Jellies].[Jam].[Plato]
} )

then in the where clause
WHERE
(
[Measures].[Profit],
[Product].[myAgg]
)


 
Thanks, FhHouse
You last message (about using Aggregate function) gave me an idea about our old bug how to fix it.

Thanks, Thanks
:)))
Issahar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top