Quantcast
Channel: SQL Server Analysis Services forum
Viewing all articles
Browse latest Browse all 14337

Recursive MDX query based on Value and maximum no of steps

$
0
0

Hi there,

I need to be able to calculate a value based on the following rules

Measure.[Max Open] = latest Non Zero Measure.[Max Bal] for the maximum of five prior days.

We have a dimension called Date with an attribute called Date.

I came up with the following Query which works fine, but it doesn't go back only 5 days :-

with Member [Measures].[Max Open]
as
iif(
    CoalesceEmpty([Measures].[Max Bal], 0) = 0, /* This is the Bool Test */ 
    ([Date].[Date].PrevMember, Measures.[Max Open]),
    (Measures.[Max Bal])
),
FORMAT_STRING = "$#,##0;-$#,##0"

My challenge is understanding how I can incorporate the date logic into the test condition. Any help would be greatly appreciated

Cheers :-)


Viewing all articles
Browse latest Browse all 14337

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>