I have SSAS Tabular cube with a table that has a decimal price
field. That cube is used as datasource for building SSRS reports. In one of those reports I need to make some calculations only over the facts in which price is higher than value given as a parameter. That parameters was created simply by drag-and-drop in Query Designer. But I don't need to search for records with exact price, I just need to set upper limit of the price.
Thus I started to look for MDX-related information to manually modify MDX query built in Query Designer. It seems like I should use Filter()
function and pass parameter value into its logical expression. There are a lot of examples in the net with logical expression where measures are used. But when I try to use dimension member in logical expression (I tried Membervalues
and Values
functions) I got different errors. I understand that the issue is much more trickier like using T-SQL.
But how to solve it? Is it possible to filter out dimension table by numeric value?
Script as follows:
SELECT
NON EMPTY
{
[Measures].[# состоявшихся аптечных визитов (с препаратами)]
} ON COLUMNS
FROM
(
SELECT
StrToSet
(@[ПродажиаптекЦена]
,CONSTRAINED
) ON COLUMNS
FROM [Аптечные визиты]
)
WHERE
IIF
(
StrToSet(@[ПродажиаптекЦена],CONSTRAINED).Count = 1
,StrToSet
(@[ПродажиаптекЦена]
,CONSTRAINED
)
,[Продажи аптек].[Цена].CurrentMember
)
CELL PROPERTIES
Value
,BACK_COLOR
,FORE_COLOR
,FORMATTED_VALUE
,FORMAT_STRING
,FONT_NAME
,FONT_SIZE
,FONT_FLAGS;