如何通过标志值过滤具有多个 CROSSJOIN 的查询中的数据
How to filter data in query with multiple CROSSJOINs by a flag value
我有一个在行和列上使用多个 CROSSJOIN 的查询我想过滤所有数据 [Measures].[Flag] = 1
这是一个例子:
SELECT
{
NonEmpty
(
CrossJoin
(
{
[Time].[2016]
,[Time].[2017]
}
,CrossJoin
(
{
[Quarters].[2 Quarter]
,[Quarters].[1 Quarter]
}
,{
[Measures].[Load]
,[Measures].[Flag]
}
)
)
)
} ON ROWS
,{CrossJoin([Industry].[Industry 1],[Client].[Set 1])} ON COLUMNS
FROM [Cube]
WHERE
[Version].[Actual];
如果我这样做:
SELECT
{
NonEmpty
(
CrossJoin
(
{
[Time].[2016]
,[Time].[2017]
}
,CrossJoin
(
{
[Quarters].[2 Quarter]
,[Quarters].[1 Quarter]
}
,{
[Measures].[Load]
,[Measures].[Flag]
}
)
)
)
} ON ROWS
,{
Filter
(
CrossJoin
(
[Industry].[Industry 1]
,[CLient].[Set 1]
)
,
[Measures].[Flag] = 1
)
} ON COLUMNS
FROM [Cube]
WHERE
[Version].[Actual];
我得到一个空集。在没有过滤器的结果集中,有 Flag = 1
的数据
如果您只是将它移到 HAVING 子句中,这有帮助吗?
SELECT
{
NonEmpty
(
CrossJoin
(
{
[Time].[2016]
,[Time].[2017]
}
,CrossJoin
(
{
[Quarters].[2 Quarter]
,[Quarters].[1 Quarter]
}
,{
[Measures].[Load]
,[Measures].[Flag]
}
)
)
)
} ON ROWS
,
CrossJoin
(
[Industry].[Industry 1]
,[CLient].[Set 1]
)
having [Measures].[Flag] = 1 ON COLUMNS
FROM [Cube]
WHERE
[Version].[Actual];
您好,我已经找到解决此问题的方法。解决方法是以不同方式使用过滤器。这是一个例子:
这里要注意的一件大事是 'Flag' 数据在特定维度配置中可用。
SELECT
{
NonEmpty
(
CrossJoin
(
{
[Time].[2016]
,[Time].[2017]
}
,CrossJoin
(
{
[Quarters].[2 Quarter]
,[Quarters].[1 Quarter]
}
,{
[Measures].[Load]
,[Measures].[Flag]
}
)
)
)
} ON ROWS
,{
Filter
(
CrossJoin
(
[Industry].[Industry 1]
,[CLient].[Set 1]
)
,
(
[Cube].(
[Time].[2016],
[Quarters].[1 Quarter],
[Measures].[Flag]
) = 1
)
)
} ON COLUMNS
FROM [Cube]
WHERE
[Version].[Actual];
我有一个在行和列上使用多个 CROSSJOIN 的查询我想过滤所有数据 [Measures].[Flag] = 1
这是一个例子:
SELECT
{
NonEmpty
(
CrossJoin
(
{
[Time].[2016]
,[Time].[2017]
}
,CrossJoin
(
{
[Quarters].[2 Quarter]
,[Quarters].[1 Quarter]
}
,{
[Measures].[Load]
,[Measures].[Flag]
}
)
)
)
} ON ROWS
,{CrossJoin([Industry].[Industry 1],[Client].[Set 1])} ON COLUMNS
FROM [Cube]
WHERE
[Version].[Actual];
如果我这样做:
SELECT
{
NonEmpty
(
CrossJoin
(
{
[Time].[2016]
,[Time].[2017]
}
,CrossJoin
(
{
[Quarters].[2 Quarter]
,[Quarters].[1 Quarter]
}
,{
[Measures].[Load]
,[Measures].[Flag]
}
)
)
)
} ON ROWS
,{
Filter
(
CrossJoin
(
[Industry].[Industry 1]
,[CLient].[Set 1]
)
,
[Measures].[Flag] = 1
)
} ON COLUMNS
FROM [Cube]
WHERE
[Version].[Actual];
我得到一个空集。在没有过滤器的结果集中,有 Flag = 1
如果您只是将它移到 HAVING 子句中,这有帮助吗?
SELECT
{
NonEmpty
(
CrossJoin
(
{
[Time].[2016]
,[Time].[2017]
}
,CrossJoin
(
{
[Quarters].[2 Quarter]
,[Quarters].[1 Quarter]
}
,{
[Measures].[Load]
,[Measures].[Flag]
}
)
)
)
} ON ROWS
,
CrossJoin
(
[Industry].[Industry 1]
,[CLient].[Set 1]
)
having [Measures].[Flag] = 1 ON COLUMNS
FROM [Cube]
WHERE
[Version].[Actual];
您好,我已经找到解决此问题的方法。解决方法是以不同方式使用过滤器。这是一个例子:
这里要注意的一件大事是 'Flag' 数据在特定维度配置中可用。
SELECT
{
NonEmpty
(
CrossJoin
(
{
[Time].[2016]
,[Time].[2017]
}
,CrossJoin
(
{
[Quarters].[2 Quarter]
,[Quarters].[1 Quarter]
}
,{
[Measures].[Load]
,[Measures].[Flag]
}
)
)
)
} ON ROWS
,{
Filter
(
CrossJoin
(
[Industry].[Industry 1]
,[CLient].[Set 1]
)
,
(
[Cube].(
[Time].[2016],
[Quarters].[1 Quarter],
[Measures].[Flag]
) = 1
)
)
} ON COLUMNS
FROM [Cube]
WHERE
[Version].[Actual];