Note that there are some explanatory texts on larger screens.

plurals
  1. POmultiple dimension restrictions in a MDX where clause
    primarykey
    data
    text
    <p>I have the following problem. If I query values with a keyfigure which is a function I can't specify multiple values of the same dimension restriction, but if it is not a function it works.</p> <p>So this works:</p> <pre><code>SELECT {[Measures].[Netto]} on columns FROM TDC where ({NonEmpty([Time].[Month].[Month].&amp;[2008-03-01T00:00:00]), NonEmpty([Time].[Month].[Month].&amp;[2008-04-01T00:00:00])}) </code></pre> <p>But this doesn't:</p> <pre><code>SELECT {[Measures].[CalculatedFunction]} on columns FROM TDC where ({NonEmpty([Time].[Month].[Month].&amp;[2008-03-01T00:00:00]), NonEmpty([Time].[Month].[Month].&amp;[2008-04-01T00:00:00])}) </code></pre> <p>And this also works:</p> <pre><code>SELECT {[Measures].[CalculatedFunction]} on columns FROM TDC where ({NonEmpty([Time].[Month].[Month].&amp;[2008-03-01T00:00:00])}) </code></pre> <p>I guess the solution is something like adding the where clause to the header but I really like this solution because it's so simple.</p> <p>The Calucated function is:</p> <pre><code>CREATE MEMBER CURRENTCUBE.[MEASURES].Ultimo AS (iif ((not [Time].[Year - Month - Date].currentmember is [Time].[Year - Month - Date].defaultmember), IIF(NOT ([Measures].[LagerStk] = 0), Sum([Time].[Year - Month - Date].[Date].members(0): ClosingPeriod([Time].[Year - Month - Date].[Date]), [Measures].[LagerStk]), NULL) , IIF(NOT ([Measures].[LagerStk] = 0), Sum([Time].[Year - Week - Date].[Date].members(0): ClosingPeriod([Time].[Year - Week - Date].[Date]), [Measures].[LagerStk]), NULL))), VISIBLE = 1; </code></pre> <p>The code is inspired from this and modified for two hierarchies in the time dimension: <a href="http://www.sqlserveranalysisservices.com/OLAPPapers/InventoryManagement%20in%20AS2005v2.htm" rel="nofollow noreferrer">http://www.sqlserveranalysisservices.com/OLAPPapers/InventoryManagement%20in%20AS2005v2.htm</a></p> <p>This is on SQL server 2005 Enterprise edition.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload