Get the first of the month for a given date in MDX as well as compound interest

Posted on 2011-03-16
Last Modified: 2014-05-04
How can I get the first non empty day from the calendar dimension.

Actually I am trying to implement a compount interest calculation

I can do that in two ways.  sum of total profit till date of month /principal as of first of date

I am not able to get the principal as of first date. I greatly appreciate is somebod has a code for it. I tried Opening Period but of no success. Getting Nulls at day level. Works at month level

the second way is

 AS ((1 + ([TradeDate].[TDHierarchy].PrevMember,Measures. [CUM_PNL_PCT])) * (1 + ([TradeDate].[TDHierarchy].CurrentMember, [Measures].[PNL Pct By Aum]))) - 1

The calc works if there are only time dimensions (Day on y axis and year and month of x axis).

If I have any other dimension it is failing.  Also I need to reset at any boundary (like new year).


Question by:obtek
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 21

Accepted Solution

Jason Yousef, MS earned 250 total points
ID: 35156434
just to let you get started...

The first day of the month is using the "OpenningPeriod"  function,

also check that it might help:

also these cheeats can help:

sorry can't help with the compound interest, hope someone else answers that.


Assisted Solution

Hwkranger earned 250 total points
ID: 35307482
To get the first day of a reporting period i use HEAD.

i've included an example that takes two metrics at the first day of the month and does a calculation between them.
 AS (HEAD(EXISTING [Date].[Calendar].[Date]
            ,[Measures].[Active Relationship])
(HEAD(EXISTING [Date].[Calendar].[Date]
            ,[Measures].[New Relationship]), 
FORMAT_STRING = "#,#;(#,#);0;\-", 

Open in new window


Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

CCModeler offers a way to enter basic information like entities, attributes and relationships and export them as yEd or erviz diagram. It also can import existing Access or SQL Server tables with relationships.
Never store passwords in plain text or just their hash: it seems a no-brainier, but there are still plenty of people doing that. I present the why and how on this subject, offering my own real life solution that you can implement right away, bringin…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question