THE CLOSINGPERIOD Function expects a level expression for the 1 argument. A member expression was used error

Lisa Kruger 60 Reputation points
2023-01-26T16:27:54.08+00:00

Hi All,

I am trying to create a MTD for LASTYEAR and when I run the query it is giving me the following error

THE CLOSINGPERIOD Function expects a level expression for the 1 argument. A member expression was used

Can someone please help me as where I am going wrong?

Thanks


with
member [Measures].[YTD Internet Sales] as
    SUM(YTD ([Charge Create Date].[Display Date Key].CurrentMember.PrevMember), [Measures].[Set 01 Charge Amount])
member [Measures].[LYTD Internet Sales] as
    SUM(YTD(PARALLELPERIOD([Charge Create Date].[Year Number],1,
            CLOSINGPERIOD([Charge Create Date].[Display Date].CurrentMember.PrevMember)
            )
           ),
        [Measures].[Set 01 Charge Amount])
select
{ [Measures].[Set 01 Charge Amount],
  [Measures].[YTD Internet Sales],
  [Measures].[LYTD Internet Sales]
} on 0,
non empty
[Charge Create Date].[Hierarchy].[Month Number Of Year].Members on 1
from [Transactions_New]
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,458 questions
SQL Server Analysis Services
SQL Server Analysis Services
A Microsoft online analytical data engine used in decision support and business analytics, providing the analytical data for business reports and client applications such as Power BI, Excel, Reporting Services reports, and other data visualization tools.
1,311 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. PercyTang-MSFT 12,511 Reputation points Microsoft Vendor
    2023-01-27T02:42:41.42+00:00

    Hi @Lisa Kruger

    For your problem, you can refer to the solution of this problem, the questioner encounters the same error as you.

    https://social.msdn.microsoft.com/Forums/en-US/087e1301-beb3-450d-aa30-8a2c050453ec/closingperiod-function-error?forum=sqlanalysisservices

    Best regards,

    Percy Tang


    If the answer is the right solution, please click "Accept Answer". If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our Documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.