MDX Filter Request

I have a query that tries to filter the results where it is equal to a specific value. The glory request works fine ...

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] = 3440.8)) ON COLUMNS FROM [Sales])

... however, an identical request, 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])

... doesn't want to work at all. I know that both of them should work fine, since both values ​​exist in the cube, and this is not just this value that does not work, but quite a lot, and as far as I can see, there is no template.

+3
source share
1 answer

I would suggest checking the data type for [Net Sales] if it is a floating point type, for example. Double, then the search for the exact value may not work. that is, the value 41581.65 may be 41581.6500001 in the database.

If you change the data types to a fixed precision, for example. Currency, then requests can work. Look at this link for many lucrative money.

+2
source

Source: https://habr.com/ru/post/1789948/


All Articles