Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8762577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:33:48+00:00 2026-06-13T15:33:48+00:00

I’m new to MDX but want to keep my code as clean as possible.

  • 0

I’m new to MDX but want to keep my code as clean as possible.

I have a query that looks at todays sales and compares them against LY and LY-1 using the ParallelPeriod function. It looks something like this..

With Member [Date].[SalesCalendar].[DateToday] as [Date].[SalesCalendar].[Date].&[2012-10-26T00:00:00]

SELECT 

    {[Date].[SalesCalendar].[DateToday],

    ParallelPeriod([Date].[SalesCalendar].[Year],1,[Date].[SalesCalendar].[Date].&[2012-10-26T00:00:00]),

    ParallelPeriod([Date].[SalesCalendar].[Year],2,[Date].[SalesCalendar].[DateToday]}

    *  

    {[Measures].[Total Sales],[Measures].[Units],[Measures].[Sales Target]}
    ON Columns,

    [Locations].[Location PK].[Location PK]
    on Rows

From MyCube

I start by defining a member that points to today’s date. I want to define it once and use it throughout this query (and other queries I write), the theory being I can change it in once place and the underlying query reacts.

The problem I have is that if I try and use this calculated member within the ParallelPeriod function I get no results. With the query above I get results for the first column and the first call to ParallelPeriod (for LY) works but the second call for LY-1, which uses the declared member, fails.

I’m guessing this is down to my lack of knowledge with MDX and so I guess I am missing something fundamental. However, banging my head against the wall isn’t working so I need some help!

Any ideas what I am doing wrong?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T15:33:49+00:00Added an answer on June 13, 2026 at 3:33 pm

    This cannot work because when your query is evaluated [Date].[SalesCalendar].[DateToday] is not replaced with [Date].[SalesCalendar].[Date].&[2012-10-26T00:00:00].

    You created a member that will give the same numeric values than [Date].[SalesCalendar].[Date].&[2012-10-26T00:00:00] in the pivot table cells.

    You can try this query:

    With Member [Date].[SalesCalendar].[DateToday] as [Date].[SalesCalendar].[Date].&[2012-10-26T00:00:00]
         Member [Measures].[name] as [Date].[SalesCalendar].CurrentMember.Name
    
    SELECT 
        {[Measures].[name], [Measures].[Total Sales]} ON Columns,
        {[Date].[SalesCalendar].[DateToday], [Date].[SalesCalendar].[Date].&[2012-10-26T00:00:00]} on Rows
    From MyCube
    

    The Total Sales will be the same but not [Measures].[name].

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I want to count how many characters a certain string has in PHP, but
I have a small JavaScript validation script that validates inputs based on Regex. I
I want use html5's new tag to play a wav file (currently only supported
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
This could be a duplicate question, but I have no idea what search terms
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have an autohotkey script which looks up a word in a bilingual dictionary

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.