Cristiano Cordeiro
Cristiano Cordeiro

Reputation: 1

Mdx, greater than works like String and not Numeric (Saiku)

I am using Saiku and trying to filter by mdx, using the symbol '> (greater than)', in the default Sales cube. The problem is that's it filtering like String and not Numeric. The values that I want for the query below is [51,52], but the server olap response is [6,7,8,9,51,52]. Any idea how can I filter that?

Here's the query:

WITH
SET [~ROWS] AS
{
    FILTER([Time].[Weekly].[Week].Members, [Time].[Weekly]. [Week].CurrentMember.Properties("Caption") > '50')
}
SELECT
NON EMPTY {[Measures].[Unit Sales]} ON COLUMNS,
NON EMPTY [~ROWS] ON ROWS
FROM [Sales]

Upvotes: 0

Views: 263

Answers (2)

whytheq
whytheq

Reputation: 35557

I think there may be alternative approaches. With experimenting as some may be more efficient.

WITH MEMBER Measures.ValueColumn as [Date].[Calendar].[July 1, 2001].MemberValue  
MEMBER Measures.KeyColumn as [Date].[Calendar].[July 1, 2001].Member_Key  
MEMBER Measures.NameColumn as [Date].[Calendar].[July 1, 2001].Member_Name  

SELECT {Measures.ValueColumn, Measures.KeyColumn, Measures.NameColumn}  ON 0  
from [Adventure Works]

Upvotes: 0

Cristiano Cordeiro
Cristiano Cordeiro

Reputation: 1

The response is to use 'Cint', like bellow:

WITH
SET [~ROWS] AS
    {
    FILTER([Time].[Weekly].[Week].Members, Cint([Time].[Weekly].[Week].CurrentMember.Properties("Caption")) > 50)
    }
SELECT
NON EMPTY {[Measures].[Unit Sales]} ON COLUMNS,
NON EMPTY [~ROWS] ON ROWS
FROM [Sales]

Upvotes: 0

Related Questions