开发者

MDX Filter Query

I have a query that is trying to filter the results where it equals a certain value. The query belows works fine...

SELECT NON EMPTY {[Date].[Year Number].Members} ON COLUMNS, 
NON EMPTY CROSSJOIN({[ItemCode].[Item Category].Members}, {[Measures].[Net Sales], [Measures].[Total Cost], [M开发者_如何学运维easures].[Profit]}) ON ROWS  
FROM (SELECT Filter([ItemCode].[Item Category].[Item Category].Members, ([Measures].[Net Sales] = 3440.8)) ON COLUMNS FROM [Sales])

...however an identical query but with a different value...

SELECT NON EMPTY {[Date].[Year Number].Members} ON COLUMNS, 
NON EMPTY CROSSJOIN({[ItemCode].[Item Category].Members}, {[Measures].[Net Sales], [Measures].[Total Cost], [Measures].[Profit]}) ON ROWS  
FROM (SELECT Filter([ItemCode].[Item Category].[Item Category].Members, ([Measures].[Net Sales] = 41581.65)) ON COLUMNS FROM [Sales])

...doesnt want to work at all. I know they both should work fine as both values exist in the cube, and it isnt just this value that doesnt work, it is quite a few, and as far as I can see there is no pattern.


I'd suggest checking the data type for [Net Sales] if it's a floating point type e.g. Double then searching for an exact value may not work. i.e. the 41581.65 value may be 41581.6500001 in the database.

If you change the data types to fixed precision e.g. Currency then the queries may work. Have a look at this link for the many benfits of money

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜