1

我正在尝试使用 DMV 从表格多维数据集中查询元数据。我能够在没有 where 子句的情况下让它工作,但我似乎无法让 where 子句工作。有什么建议吗?

这是有效的代码:

SELECT 
    [MEASURE_CAPTION]           AS [Measure]
    ,[MEASURE_IS_VISIBLE]       AS [Visable]
    ,[DESCRIPTION]              AS [Description]
    ,[MEASURE_DISPLAY_FOLDER]   AS [Display Folder]
    ,[EXPRESSION]               AS [Calculation]
FROM $SYSTEM.MDSCHEMA_MEASURES

我尝试过的 WHERE 子句是:

WHERE ([MEASURE_IS_VISIBLE].[members].[true])

我收到以下错误:

The dot expression is not allowed in the context at line 9, column 1.

还:

WHERE [MEASURE_IS_VISIBLE] = TRUE

我收到以下错误:

Error: A Boolean expression is not allowed in the context at line 9, column 7.

我在这些主题上尝试了很多版本,但总是得到相同的结果。我完全不熟悉 MDX 的工作原理,因此我们将不胜感激。

4

1 回答 1

5

MEASURE_IS_VISIBLE是一个布尔列,必须按此过滤。以下查询将结果筛选为仅MEASURE_IS_VISIBLE值为 true 的结果。将其更改WHERE NOT MEASURE_IS_VISIBLE为错误的行。您可以从此处的文档中查看此 DMV 的数据类型。

SELECT 
    [MEASURE_CAPTION]           AS [Measure]
    ,[MEASURE_IS_VISIBLE]       AS [Visable]
    ,[DESCRIPTION]              AS [Description]
    ,[MEASURE_DISPLAY_FOLDER]   AS [Display Folder]
    ,[EXPRESSION]               AS [Calculation]
FROM $SYSTEM.MDSCHEMA_MEASURES 
WHERE MEASURE_IS_VISIBLE 
于 2018-12-12T20:14:45.657 回答