Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I suppress individual cell values in an MDX query?
    primarykey
    data
    text
    <p>I've got an MDX query that's returning 2 different values, a total number of lookups and a number of lookups failed (and some other stuff, but that's the important part).</p> <pre><code> with member [Pct Success] as 'iif(isempty([Num Lookup]) or [Num Lookup]=0, null, 100 * (coalesceempty([Num Lookup] - [Num Failed], 0) / [Num Lookup]))' select { [Measures].[Pct Success], [Measures].[Num Lookup], [Measures].[Num Failed] } on 0, [Calendar].[Date].children on 1 from [Cube] </code></pre> <p>Now what I'm trying to do is to get another success measurement, but I want this one to suppress any [Num Failed] cells that are below a specific threshold. Specifically, if I have at least 4 successful lookups (Num Lookup - Num Failed > 3 &amp;&amp; Num Lookup > 4), then I want to make that cell's [Num Failed] = 0 (or rather I want to make a copy of [Num Failed] = 0 since I still need to display the original % Success measure).</p> <p>The underlying facts look like this (just the pertinent subset of columns - the Line column is there for ease of reference, it's not in the actual facts):</p> <pre> Line | CalendarKey | Num Failed | Num Lookup 1 | 20130601 | 2 | 8 2 | 20130601 | 5 | 8 3 | 20130601 | 1 | 8 4 | 20130601 | 0 | 7 5 | 20130601 | 7 | 8 6 | 20130602 | 2 | 6 7 | 20130602 | 1 | 7 8 | 20130602 | 5 | 10 9 | 20130602 | 7 | 9 etc. </pre> <p>What I expect to see for results based on those facts above is:</p> <pre> | % Success | % Filt Success | Num Filt Failed | Num Failed | Num Lookup 20130601 | 61.53 | 69.23 | 12 | 15 | 39 20130602 | 53.13 | 71.88 | 9 | 15 | 32 </pre> <p>In the above fact sample, lines 1, 3, 4, 7 &amp; 8 all would have a filtered failed value of 0, which gives us the sample output listed above.</p> <p>My initial thought is to use another member in the with clause as the copy of [Num Failed] and then a Cell Calculation to do the suppression, but I can't get the Cell Calculation to work correctly - it either doesn't modify the value, or it errors out during evaluation.</p> <p>Here's the non-working version that "should" return what I'm looking for, but doesn't:</p> <pre><code>with member [Measures].[Num Threshold Failure] AS [Num Failed] Cell Calculation [Data Filter] For '[Measures].[Num Threshold Failure]' AS 'NULL', Condition = 'CalculationPassValue((([Measures].[Num Lookup] - [Measures].[Num Failure]) &lt; 4) AND ([Measures].[Num Lookup] &gt; 4), 1)' member [Pct Success] as 'iif(isempty([Num Lookup]) or [Num Lookup]=0, null, 100 * (coalesceempty([Num Lookup] - [Num Failed], 0) / [Num Lookup]))' member [Pct Filtered Success] as 'iif(isempty([Num Lookup]) or [Num Lookup]=0, null, 100 * (coalesceempty([Num Lookup] - [Num Threshold Failure], 0) / [Num Lookup]))' select { [Measures].[Pct Success], [Measures].[Pct Filtered Success], [Measures].[Num Threshold Failure], [Measures].[Num Failed], [Measures].[Num Lookup] } on 0, { [Calendar].[Date].children } on 1 from [Cube] </code></pre>
    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.
 

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