0

I'm trying to write a mdx that contain rows of parallel days. The problem is that my hyrarchy is by month. That's my query, but know i need to make it dynamcly. What is the right syntax?

The Code

1 Answer 1

0

If you need to programmatically go back 7 days then you can apply the lag function to the end of a date member:

[Date time Online].[Date Key].&[201602152300].lag(7)

If you need to feed now() into an mdx script this pattern is helpful:

WITH
  MEMBER [Measures].[Key for Today] AS 
    Format
    (
      Now()
     ,'yyyyMMdd'
    ) 
  MEMBER [Measures].[Today string] AS 
    '[Date].[Calendar].[Date].&[' + [Measures].[Key for Today] + ']' 
  SET [Today] AS 
    StrToMember
    (
      [Measures].[Today string]
     ,constrained
    ) 
...
1
  • i want to know how to replace the hard code date to current date like now()
    – Sara
    Apr 12, 2016 at 5:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.