MDX WHERE NOT IN () is equivalent in many dimensions

There are many, many dimensions in my cube (alongside other regular dimensions). When I want to exclude fact lines in a line count counter, I usually do something like the following in MDX

SELECT [Measures].[Row Count] on 0
FROM cube
WHERE ([dimension].[attribute].Children - [dimension].[attribute].&[value])

This may seem more complex than necessary in this simple example, but in this case WHERE, including UNIONs, can sometimes grow.

So this works for regular measurements, but now I have a multi-multidimensional measurement. If I perform the trick above, it does not give the desired result, namely, I want to exclude all rows that have this particular attribute in the many-to-many dimension.

In fact, it does exactly what MDX sets, namely, counting all rows, but ignores the specified attribute. Since a row in a fact table can have several attributes in the many-in-many set, the row will still be counted.

This is not what I need, I need to explicitly exclude rows that have a dimension attribute value. In addition, I can exclude several values. So I need something similar to T-SQL WHERE .. NOT IN (...)

I understand that I can simply subtract the resulting values ​​from [attribute] .all and [attribute]. & [value], but this will not work with UNIONing multiple WHERE statements.

Has anyone got a good idea on how to solve this?

Thanks in advance,

Delta p>

+3
source share
3 answers

, , , , , (, ).

, , ( M2M OrderID Category), : ( EXISTS -)

[Orders].[Order ID].[Order ID].Members 
- EXISTS([Orders].[Order ID].[Order ID].Members
       , [Product].[Category].&[Bikes]
       , "Order Facts")

, SSAS .

+1

EXCEPT? :

EXCEPT({the set i want}, {a set of members i dont want})

0

Filter:

SELECT [Measures].[Row Count] on 0
FROM [cube]
WHERE Filter([dimension].[attribute].Children, [dimension].CurrentMember.MemberValue <> value)
0

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


All Articles