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


SQL OR with MDX


SQL OR with MDX

Author
Message
shyamhr
shyamhr
Old Hand
Old Hand (316 reputation)Old Hand (316 reputation)Old Hand (316 reputation)Old Hand (316 reputation)Old Hand (316 reputation)Old Hand (316 reputation)Old Hand (316 reputation)Old Hand (316 reputation)

Group: General Forum Members
Points: 316 Visits: 323
I have a Measure called Supplier Number in the cube. The Supplier table acts as a Dimension as well as Fact table in the Cube.

There are two dimensions - CreationDate and Modification date that are linked to Supplier fact table.

My requirement is to get the Supplier Number which got Created (CreationDate) or which got modified (Modification date) for any current month selected.

How to achieve this in MDX?

Hint: This is like a SQL OR condition with CreationDate and Modification Date.
PB_BI
PB_BI
SSCarpal Tunnel
SSCarpal Tunnel (4.6K reputation)SSCarpal Tunnel (4.6K reputation)SSCarpal Tunnel (4.6K reputation)SSCarpal Tunnel (4.6K reputation)SSCarpal Tunnel (4.6K reputation)SSCarpal Tunnel (4.6K reputation)SSCarpal Tunnel (4.6K reputation)SSCarpal Tunnel (4.6K reputation)

Group: General Forum Members
Points: 4596 Visits: 2747
You can put this into the Where condition in a query for a simple solution. For example in AdventureWorks this:

SELECT
NON EMPTY [Measures].[Reseller Sales Amount] ON 0,
[Geography].[State-Province].[State-Province] ON 1

FROM
[Adventure Works]

WHERE
{[Geography].[Geography].[State-Province].&[NY]&[US],
[Geography].[Geography].[State-Province].&[SD]&[US]}


...would give you reseller sales in New York or South Dakota.




I'm on LinkedIn
//Ravi
//Ravi
SSChasing Mays
SSChasing Mays (638 reputation)SSChasing Mays (638 reputation)SSChasing Mays (638 reputation)SSChasing Mays (638 reputation)SSChasing Mays (638 reputation)SSChasing Mays (638 reputation)SSChasing Mays (638 reputation)SSChasing Mays (638 reputation)

Group: General Forum Members
Points: 638 Visits: 451
If you are pulling the data from a Cube, then MDX. If you are pulling from SQL Database, then SQL.

If you are going to be working a lot with cubes, I highly recommend learning MDX. It's quite easy to learn, it just messes with your head if you think in SQL terms (two dimensions).

An awesome book to learn from is: http://www.amazon.com/Practical-MDX-Queries-Microsoft-Analysis/dp/0071713360/ref=sr_1_1?ie=UTF8&qid=1394041795&sr=8-1&keywords=mdx

I sat down the whole weekend and read through the book, and became pretty good at writing MDX by monday. This book walks you thought examples, which is quite easy to learn from.

------------
Smile
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