Mysql 使用MDX中的“不同定义”计算相同度量值的差异
我想计算相同度量值的差异,但“定义不同” 这是我尝试过的,但不起作用:Mysql 使用MDX中的“不同定义”计算相同度量值的差异,mysql,mdx,olap,Mysql,Mdx,Olap,我想计算相同度量值的差异,但“定义不同” 这是我尝试过的,但不起作用: WITH MEMBER [Measures].[Births] AS '[Measures].[type], [dimType].[TypeL].[Births]' MEMBER [Measures].[Deaths] AS '[Measures].[type], [dimType].[TypeL].[Deaths]' MEMBER [Measures].[Population_Growth] AS '[Me
WITH MEMBER [Measures].[Births] AS
'[Measures].[type], [dimType].[TypeL].[Births]'
MEMBER [Measures].[Deaths] AS
'[Measures].[type], [dimType].[TypeL].[Deaths]'
MEMBER [Measures].[Population_Growth] AS
'[Measures].[Births] - [Measures].[Deaths]'
SELECT [Measures].[Population_Growth] ON COLUMNS,
[dimTime].[year] ON ROWS FROM [Population]
运行此查询时,我得到每年的人口增长率=0。
我是MDX新手,不知道自己做错了什么?不确定。在MDX中,您计算了一个元组。如果只有一个成员,则不需要括号,但如果有多个成员,则需要括号。你能试试吗
WITH
MEMBER [Measures].[Births] AS ([Measures].[type], [dimType].[TypeL].[Births])
MEMBER [Measures].[Deaths] AS ([Measures].[type], [dimType].[TypeL].[Deaths])
MEMBER [Measures].[Population_Growth] AS [Measures].[Births] - [Measures].[Deaths]
SELECT
[Measures].[Population_Growth] ON COLUMNS,
[dimTime].[year] ON ROWS
FROM [Population]
如果这不起作用,可能是[type]度量:
WITH
MEMBER [Measures].[Births] AS ([Measures].defaultmember, [dimType].[TypeL].[Births])
MEMBER [Measures].[Deaths] AS ([Measures].defaultmember, [dimType].[TypeL].[Deaths])
MEMBER [Measures].[Population_Growth] AS [Measures].[Births] - [Measures].[Deaths]
SELECT
[Measures].[Population_Growth] ON COLUMNS,
[dimTime].[year] ON ROWS
FROM [Population]
如果这不起作用,我们可以检查成员[dimType].[TYPE].[BARTHINGS]是否正常
WITH
MEMBER [Measures].[Population_Growth] AS [dimType].[TypeL].[Births].name
SELECT
[Measures].[Population_Growth] ON COLUMNS,
[dimTime].[year] ON ROWS
FROM [Population]
这将返回“出生”