MDX Mondrian:将秒整数转换为时间格式" dd,hh,mm,ss"

时间:2017-01-13 15:32:56

标签: mdx pentaho olap mondrian

我想将对应于总秒数的整数输入转换为时间格式:

n天,hh,mm,ss

示例:176553秒= 2天,01:02:33

我开始尝试这种格式:

    WITH MEMBER [Measures].[TIMECONVERTED] 
AS '[Measures].[Durees totales en secondes]/ 86400', FORMAT_STRING = "hh:mm:ss"

但那并没有奏效,

(可能是因为 [Measures]。[Durees totales en secondes] 是数字

所以在google搜索之后我找到了解决方案,这也没有用,详情如下:

这是我的MDX脚本(我在jasperServer中为OLAP显示执行它):

with member [Measures].TIMECONVERTED as [Measures].[Durees totales en secondes]
 ,format_string 
   = 
    IIF(
      [Measures].TIMECONVERTED  < 1
     ,'d "days" hh:mm:ss'
     ,'"' + cstr(int([Measures].TIMECONVERTED )) + ' days" hh:mm:ss')
select NON EMPTY {
[Measures].TIMECONVERTED ,
[Measures].[Durees totales en minutes],
[Measures].[Durees totales en secondes],
[Measures].[Nombre appels repondus],
[Measures].[Nombre Appels sortants],
[Measures].[Durees appels repondus en minutes],
[Measures].[Durees appels sortants en minutes],
[Measures].[Durees appels repondus en secondes], 
[Measures].[Durees appels sortants en secondes]
} ON COLUMNS,
  NON EMPTY Crossjoin(Hierarchize({([Times.Time].[All Times.Times], [Agents.Agent].[All Agents.Agents])}), {[Clients.Client].[All Clients.Clients]}) ON ROWS
from [cube_durees_appels]
  

这告诉我,蒙德里安并不知道&#34; cstr&#34; fonction

任何提议?

1 个答案:

答案 0 :(得分:1)

According to the Mondrian documentations您必须使用Cast功能。