CLOSINGPERIOD功能错误 [英] CLOSINGPERIOD Function Error

查看:138
本文介绍了CLOSINGPERIOD功能错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


当我在SSMS中使用以下select语句时连接到Analysis Services

 SELECT [Measures]。[Invoice Amnt] ON 0 
,ClosingPeriod([发票日期]。[发票日期]。[ID]。[月份名称],[发票日期]。[所有期间])。滞后(12 )
:ClosingPeriod([发票日期]。[发票日期]。[ID]。[月份名称],[发票日期]。[所有期间])ON 1

FROM [DWImport ]

我收到以下错误


执行查询...

查询(2,3)CLOSINGPERIOD函数需要1参数的级别表达式。使用了一个成员表达式。

运行完成

我只知道基础知识而且我使用的是多维模型。我试图计算过去12个月的总数。


任何意见或建议都表示赞赏。


谢谢

解决方案

 WITH 
会员[测量]。[开始余额] AS

OPENINGPERIOD

[日期]。[日历]。[月],
[日期]。[日历]。现在会员
),
[度量]。[互联网销售额]
),FORMAT_STRING ="货币"

会员[度量]。[结束余额] AS

CLOSINGPERIOD

[日期]。[日历] ]。[月],
[日期]。[日历]。现在会员
),
[度量]。[互联网销售额]
),FORMAT_STRING ="货币"

SELECT
{
[Measures]。[Internet Sales Amount],
[Measures]。[Begin Balance],
[Measures]。[结束余额]
} ON COLUMNS

[Date]。[Calendar]。[Calendar Quarter]
ON ROWS
FROM [Adventure Works]

你使用正确的synatax参考上面的代码示例。


https://www.mssqltips.com/sqlservertip/2877/sql-server-analysis-serviceslead-lag-openingperiod-closingperiod -time相关函数/


Hello ,

When i am using the following select statement in SSMS Connecting to Analysis Services

SELECT [Measures].[Invoice Amnt] ON 0
, ClosingPeriod([Invoice Date].[Invoice Date].[ID].[Month Name],[Invoice Date].[All Periods]).Lag(12)
: ClosingPeriod([Invoice Date].[Invoice Date].[ID].[Month Name],[Invoice Date].[All Periods]) ON 1

FROM [DWImport]

I am getting the following error

Executing the query ...
Query (2, 3) The CLOSINGPERIOD function expects a level expression for the 1 argument. A member expression was used.
Run complete

I know just the basics and i am using a Multi dimensional model. I am trying to calculate the trailing 12 months total.

Any advice or suggestions is appreciated.

Thanks

解决方案

WITH 
 MEMBER [Measures].[Begin Balance] AS 
 (
 OPENINGPERIOD
 (
 [Date].[Calendar].[Month],
 [Date].[Calendar].CurrentMember
 ),
 [Measures].[Internet Sales Amount]
 ),FORMAT_STRING = "Currency"
  
 MEMBER [Measures].[End Balance] AS 
 (
 CLOSINGPERIOD
 (
 [Date].[Calendar].[Month],
 [Date].[Calendar].CurrentMember
 ),
 [Measures].[Internet Sales Amount]
 ),FORMAT_STRING = "Currency"

SELECT 
 {
 [Measures].[Internet Sales Amount],
 [Measures].[Begin Balance],
 [Measures].[End Balance] 
 } ON COLUMNS
 ,
 [Date].[Calendar].[Calendar Quarter]
  ON ROWS
FROM [Adventure Works]

you have use correct synatax refer above sample of code.

https://www.mssqltips.com/sqlservertip/2877/sql-server-analysis-serviceslead-lag-openingperiod-closingperiod-time-related-functions/


这篇关于CLOSINGPERIOD功能错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆