title: OLAP/MDX - define calculated member, sum all time to date data
body: <p>I would like to define "all time to date" calculated member in OLAP cube. I'm able to calculate YTD by using the following:</p>
  
  <pre><code>SUM(YTD([Time].[Month].CurrentMember), [Measures].[Suits])
  </code></pre>
  
  <p>How can I include all dates since the beginning of my data? My time dimension looks like:</p>
  
  <pre><code>&lt;Dimension type="TimeDimension" visible="true" foreignKey="granularity" highCardinality="false" name="Time"&gt;
    &lt;Hierarchy name="Time" visible="true" hasAll="true" primaryKey="eom_date"&gt;
      &lt;Table name="v_months" schema="bizdata"&gt;
      &lt;/Table&gt;
      &lt;Level name="Year" visible="true" column="year_number" type="String" uniqueMembers="false" levelType="TimeYears" hideMemberIf="Never"&gt;
      &lt;/Level&gt;
      &lt;Level name="Quarter" visible="true" column="quarter_number" type="String" uniqueMembers="false" levelType="TimeQuarters" hideMemberIf="Never"&gt;
      &lt;/Level&gt;
      &lt;Level name="Month" visible="true" column="month_number" type="String" uniqueMembers="false" levelType="TimeMonths" hideMemberIf="Never"&gt;
      &lt;/Level&gt;
    &lt;/Hierarchy&gt;
  &lt;/Dimension&gt;
  </code></pre>
  
  <p>Not sure if relevant: I'm using mondrian olap server (running on tomcat), Saiku as frontend, postgres as database</p>
  
  <p>I've tried a lot of combinations, but I can't figure it out.</p>
  
  <p>Update: I've tried to use syntax suggested by Gonsalu:</p>
  
  <pre><code>&lt;CalculatedMember name="YTD Suits" formatString="" formula="SUM(YTD([Time].[Month].CurrentMember), [Measures].[Suits])" dimension="Measures" visible="true"&gt;
  &lt;/CalculatedMember&gt;
  &lt;CalculatedMember name="PTD Suits" formatString="" formula="Sum({NULL:[Time].[Month].CurrentMember },[Measures].[Suits])" dimension="Measures" visible="true"&gt;
  &lt;/CalculatedMember&gt;    
  </code></pre>
  
  <p>Using this I get the following error message when starting mondrian (note that YTD function works well without the second calculated member):</p>
  
  <pre><code>Caused by: mondrian.olap.MondrianException: Mondrian Error:Failed to parse query
   'WITH
  MEMBER [Measures].[Measures].[YTD Suits]
    AS 'SUM(YTD([Time].[Month].CurrentMember), [Measures].[Suits])',
      [$member_scope] = 'CUBE',
  MEMBER_ORDINAL = 6
  MEMBER [Measures].[Measures].[PTD Suits]
    AS 'Sum({NULL:[Time].[Month].CurrentMember },[Measures].[Suits])',
  [$member_scope] = 'CUBE',
  MEMBER_ORDINAL = 7
  SELECT FROM [Project Performance]'  
  </code></pre>
  
  <p>Thank you for any ideas.</p>