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

Rank function

$
0
0

I have an MDX Query that is using the rank function, but it is not resetting the rank value when the top level of the hierarchy changes.  I want to use MDX to get the same values I would get when using the TSQL Row_Number () over (partition by ...) function.  Here is a sample of the actual output and desired output from the query below:

HourNumHighLowDiffHighLowDiffMode(actual)HighLowDiffMode(desired)
0022
0111
0233
1041
1163
1252


WITH SET HourDiff AS 
Order (([Dim Date Time].[Hour Num].Children,[Gbp Usd Gaps H1].[High Low Diff].Children),[Measures].[High Low Diff],DESC)

MEMBER [Measures].[High Low Diff Mode] AS
Rank (([Dim Date Time].[Hour Num].CurrentMember,[Gbp Usd Gaps H1].[High Low Diff].CurrentMember), HourDiff)

SELECT
{	[Measures].[High Low Diff Mode]	} ON COLUMNS,
{	([Dim Date Time].[Hour Num].Children,[Gbp Usd Gaps H1].[High Low Diff].Children)	} ON ROWS
FROM h1



Viewing all articles
Browse latest Browse all 14337

Trending Articles



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