mysticfall / pivot4j

Pivot4J provides a common API for OLAP servers which can be used to build an analytical service frontend with pivot style GUI.
Other
128 stars 101 forks source link

Cross Join not applying correctly while place multiple members on slicers #175

Open chandankarpankaj opened 9 years ago

chandankarpankaj commented 9 years ago
SELECT {[Measures].[MEM1], [Measures].[MEM2]} ON COLUMNS,
 Hierarchize(Union(CrossJoin({[Date].[2012]}, {[CLASS].[CLASS1]}), CrossJoin({[Date].[2012]}, [CLASS].[CLASS1].Children))) ON ROWS
 FROM [MYCUBE]
 WHERE CrossJoin([Dataversion].[ACTUAL], [SCENARIO].[ALL])

In above query: cross join on rows has format CrossJoin({SET1},{SET2}) but when we apply multiple members on slicers CrossJoin is used after 'WHERE' having different syntax CrossJoin(MEM1,MEM2)

there should be SET1 and SET2 instead of applying members for CrossJoin on slicer

mysticfall commented 9 years ago

I'm sorry if I didn't understand you correctly, but is there any reason why you want to use a set expression instead of a member name even when there's only one member of the hierarchy in the slicer?

Currently, it tries to normalize the expression to strip any redundant set expressions, so when it finds a set with only one child member, it'll replace it with a plain member name.

By the way, this behavior is shared between column/row axes and the slicer. So, if you place hierarchies on either a column or a row axis, and deselect every members except for one, the resulting mdx will be similar to one in your example.

Please instruct me if I misunderstood the problem. There's chance it could be the case, as I'm not that knowledgable in MDX anyway.

tuplesoft commented 7 years ago

Actually his issue is very simple. Crossjoin is always has sets. Pls refere https://msdn.microsoft.com/en-us/library/ms144816.aspx

What is happening in his case is that in the where clause CrossJoin({[Dataversion].[ACTUAL], [SCENARIO].[ALL]}) is being changed to CrossJoin([Dataversion].[ACTUAL], [SCENARIO].[ALL]). The '{}' operator is removed since one set is there in the CrossJoin. It should either remain CrossJoin({[Dataversion].[ACTUAL], [SCENARIO].[ALL]}) or CrossJoin should be removed for the where clause.