1

There is the "Show fields related to:" feature in Excel: enter image description here I want something like this, but return in the following form:

MeasureGroup1: Dimension1, Dimension2, Dimesion3
MeasureGroup2: Dimension2, Dimesion3
...

Can't find out how Excel retrieve this data. I need to write a script which will automatically generate the relationship data for a chosen cube. It can be MDX or XMLA. ADO.NET in the last resort (it should be a portable script after all).

Hope you can help.

Danylo Korostil
  • 1,464
  • 2
  • 10
  • 19
  • really unsure of how to do this - the mdx function EXISTS uses measure group as its 3rd argument - would this function help? – whytheq Apr 14 '17 at 11:44
  • Not really, It works with sets and querying huge dimensions is heavy. There is also MeasureGroupMeasures('MeasureGroup1').Item(0), however doesn't work with Visible = False measures. – Danylo Korostil Apr 14 '17 at 12:42

2 Answers2

2

The following returns a recordset which Excel uses to determine which dimensions are related to which measure groups:

select *
from $system.MDSCHEMA_MEASUREGROUP_DIMENSIONS
GregGalloway
  • 11,355
  • 3
  • 16
  • 47
1

Plus the xmla solution:

<Discover xmlns="urn:schemas-microsoft-com:xml-analysis">
    <RequestType>MDSCHEMA_MEASUREGROUP_DIMENSIONS</RequestType>
    <Restrictions />
    <Properties />
</Discover>
Danylo Korostil
  • 1,464
  • 2
  • 10
  • 19