Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/58.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql 使用MDX中的“不同定义”计算相同度量值的差异_Mysql_Mdx_Olap - Fatal编程技术网

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]
这将返回“出生”