Both solutions work.
1) For the range solution, you need to add a measure that uses CLOSE aggregation mode on the Time Dimension as we want the 'state' as of the last day of any time period. Also, both dates are included when using range, so end date should be one day before the start of the next bucket.
You can use Sum or Eval instead of Aggregate. Eval will be faster if the same time period is reused multiple times in the same query as the subcube is cached.
CREATE MEMBER [#changes ITD 2] as Eval( compactSet(NULL:[Time].[Time].currentMember) , ([Time].[Time].defaultMember,[Measures].[# changes (based on delta)]) )
2) For Purple Frog one, I'd use compactSet for the calculated member as without the calculated function will quickly degradated when getting more an more data. It's 365 days for each year, so if you've 10 years you'll have 3650 sums without de compactSet. With the compactSet, we can use it as the measure is additive, instead of 10 years will have something like, 9 (years) + 11 (months) + 31(days) , that is a lot less on the worst scenario.
Which one to use ?
1) It uses more memory but the performance is faster and amazingly stable as we're using the last day of the period value. Adding other time hierarchies might give some unexpected results.
CREATE MEMBER [#changes ITD] as Aggregate( compactSet(NULL:[Time].[Time].currentMember) , [Measures].[# changes (based on delta)] )
2) It uses less memory, we only save two points, but it a bit slower.
On both I'd pay attention that adding, and using, other Time hierarchies and Time dimensions might give some 'strange' results.
Here the updated schema ( [#changes ITD] definition is included)
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<schemaFactory revisionNumber="11">
<schemaDefinition name="Phases - ranged dimension II" description="issue description StackOverflow" group="StackOverflow" loadOnStartup="false">
<activateIncrementalLoad>false</activateIncrementalLoad>
<useUnknownMembersInFacts>false</useUnknownMembersInFacts>
<autoCleanUpTableColumns>false</autoCleanUpTableColumns>
<useFactPartitioning>false</useFactPartitioning>
<callGarbageCollector>NONE</callGarbageCollector>
<backup>NONE</backup>
<nonEmptyCachePolicy>NONE</nonEmptyCachePolicy>
<nonEmptyCacheType>REGULAR</nonEmptyCacheType>
<nonEmptyCachePersistency>MEMORY</nonEmptyCachePersistency>
<storagePolicy>DEFAULT</storagePolicy>
<hierarchyUniqueNameStyle>IncludeDimensionName</hierarchyUniqueNameStyle>
<inMemoryDS name="manual">
<memoryDataTable tableName="facts" rowLimit="-1" id="c41cc2b5-1412-4da1-8e0e-3bd1b07e9d66">
<column name="start" tableType="STRING" type="DATE" selected="true" primaryKey="false" nullObjectAsString=""/>
<column name="end" tableType="STRING" type="DATE" selected="true" primaryKey="false" nullObjectAsString=""/>
<column name="phase" tableType="STRING" type="STRING" selected="true" primaryKey="false" nullObjectAsString=""/>
<column name="chg" tableType="STRING" type="STRING" selected="true" primaryKey="false" nullObjectAsString=""/>
<column name="#changes" tableType="STRING" type="INTEGER" selected="true" primaryKey="false" nullObjectAsString=""/>
<addRowNumber>false</addRowNumber>
<stringDateConverter>d MMM, yyyy</stringDateConverter>
<stringDateConverterLocale>en</stringDateConverterLocale>
<trimStrings>true</trimStrings>
<columnSeparator>;</columnSeparator>
<commentMarker>#</commentMarker>
<dataAsString>start;end;phase;chg;#changes
1 January, 2018;31 January, 2018; a;chg001;1
1 February, 2018;4 March, 2018;b;chg001;1
5 March, 2018;19 March, 2018;c;chg001;1
20 March, 2018;19 March, 2018;d;chg001;1
20 March, 2018;2 June, 2018;e;chg001;1
</dataAsString>
</memoryDataTable>
<memoryDataTable tableName="phases" rowLimit="-1" id="b24aaebb-7ce3-42a9-bab0-a54bc4c4b896">
<column name="phase" tableType="STRING" type="STRING" selected="true" primaryKey="false" nullObjectAsString=""/>
<addRowNumber>false</addRowNumber>
<stringDateConverter></stringDateConverter>
<trimStrings>true</trimStrings>
<columnSeparator>,</columnSeparator>
<commentMarker>#</commentMarker>
<dataAsString>phase
a
b
c
d
e
</dataAsString>
</memoryDataTable>
<memoryDataTable tableName="changes" rowLimit="-1" id="8ba9aaca-0d93-49b1-851f-4f325e05bbbe">
<column name="chg" tableType="STRING" type="STRING" selected="true" primaryKey="false" nullObjectAsString=""/>
<addRowNumber>false</addRowNumber>
<stringDateConverter></stringDateConverter>
<trimStrings>true</trimStrings>
<columnSeparator>;</columnSeparator>
<commentMarker>#</commentMarker>
<dataAsString>chg
chg001
chg002
chg003</dataAsString>
</memoryDataTable>
<memoryDataTable tableName="facts - delta" rowLimit="-1" id="aea29582-84e2-4ef4-a169-5d9549141ba6">
<column name="date" tableType="STRING" type="DATE" selected="true" primaryKey="false" nullObjectAsString=""/>
<column name="phase" tableType="STRING" type="STRING" selected="true" primaryKey="false" nullObjectAsString=""/>
<column name="chg" tableType="STRING" type="STRING" selected="true" primaryKey="false" nullObjectAsString=""/>
<column name="delta" tableType="STRING" type="INTEGER" selected="true" primaryKey="false" nullObjectAsString=""/>
<addRowNumber>false</addRowNumber>
<stringDateConverter>d MMM, yyyy</stringDateConverter>
<stringDateConverterLocale>en</stringDateConverterLocale>
<trimStrings>true</trimStrings>
<columnSeparator>;</columnSeparator>
<commentMarker>#</commentMarker>
<dataAsString>date;phase;chg;delta
1 January, 2018;a;chg001;1
1 February, 2018;b;chg001;1
5 March, 2018;c;chg001;1
20 March, 2018;d;chg001;1
20 March, 2018;e;chg001;1
1 February, 2018;a;chg001; -1
5 March, 2018;b;chg001;-1
20 March, 2018;c;chg001;-1
20 March, 2018;d;chg001;-1
13 June, 2018;e;chg001;-1
</dataAsString>
</memoryDataTable>
</inMemoryDS>
<multiLevelDimension dataTableId="8ba9aaca-0d93-49b1-851f-4f325e05bbbe" isTimeDimension="false" isDefaultTimeDimension="false" isIndexingByRange="false" id="0c4cf980-73d9-4c42-ae47-a300421c29a2" name="Change">
<multiLevelHierarchy hasAllLevel="true" allLevelName="All-Level" allMemberName="All" name="Change" isDefault="true">
<level name="change" nameUnique="false" nameUniqueInParent="false" keyUnique="false" ignoreNameCollision="false">
<nameCol name="chg"/>
<orderType>BY_NAME</orderType>
<orderKind>ASC</orderKind>
</level>
</multiLevelHierarchy>
</multiLevelDimension>
<multiLevelDimension dataTableId="b24aaebb-7ce3-42a9-bab0-a54bc4c4b896" isTimeDimension="false" isDefaultTimeDimension="false" isIndexingByRange="false" id="ed48052e-2c11-48a8-9407-c4854b163cb6" name="Phase">
<multiLevelHierarchy hasAllLevel="true" allLevelName="All-Level" allMemberName="All" name="Phase" isDefault="true">
<level name="phase" nameUnique="false" nameUniqueInParent="false" keyUnique="false" ignoreNameCollision="false">
<nameCol name="phase"/>
<orderType>BY_NAME</orderType>
<orderKind>ASC</orderKind>
</level>
</multiLevelHierarchy>
</multiLevelDimension>
<timeWizardDimension isDefaultTimeDimension="false" isIndexingByRange="true" from="2018-06-01T00:00:00.000" to="2018-07-31T00:00:00.000" dataTableId="c41cc2b5-1412-4da1-8e0e-3bd1b07e9d66" unknownMemberName="" id="b545bf65-ec47-4267-a4f1-a8df35096bc4" name="Time">
<timeHierarchy hasAllLevel="true" allLevelName="All-L" allMemberName="All-M" name="Time" isDefault="true" defaultMemberName="">
<factAggregationType>MEMBER_AND_ANCESTORS</factAggregationType>
<level name="Year" type="YEAR">
<useRelativeKey>false</useRelativeKey>
</level>
<level name="Month" type="MONTH" nameFormat="">
<useRelativeKey>false</useRelativeKey>
</level>
<level name="Day" type="DAY" nameFormat="">
<useRelativeKey>false</useRelativeKey>
</level>
</timeHierarchy>
<timeWizardColumn name="start"/>
</timeWizardDimension>
<cube id="b9aceb66-c3dc-4d20-9f74-1ada8769cf75" name="Changes" description="">
<defaultFacts measureGroupName="Facts" partitioningLevelName="" partitioningType="NONE" newGeneration="true" dataTableId="c41cc2b5-1412-4da1-8e0e-3bd1b07e9d66" aggregateDataSourceFacts="false" unresolvedRowsBehavior="ERROR">
<rowFactAggregationType>ADD_ROW</rowFactAggregationType>
<measure name="# changes" aggregationType="SUM">
<rollupHierarchy></rollupHierarchy>
<dataColumn name="#changes"/>
<cellProperties></cellProperties>
<emptyIsZero>false</emptyIsZero>
</measure>
<measure name="# changes close" aggregationType="CLOSE">
<rollupHierarchy>[Time].[Time]</rollupHierarchy>
<dataColumn name="#changes"/>
<cellProperties></cellProperties>
<emptyIsZero>false</emptyIsZero>
</measure>
<links dimensionId="0c4cf980-73d9-4c42-ae47-a300421c29a2">
<viewLinks type="LAST_LEVEL">
<toColumns name="chg"/>
</viewLinks>
</links>
<links dimensionId="ed48052e-2c11-48a8-9407-c4854b163cb6">
<viewLinks type="LAST_LEVEL">
<toColumns name="phase"/>
</viewLinks>
</links>
<links dimensionId="b545bf65-ec47-4267-a4f1-a8df35096bc4">
<viewLinks type="RANGE_FROM_TO">
<toColumns name="start"/>
<toColumns name="end"/>
</viewLinks>
</links>
</defaultFacts>
<defaultFacts measureGroupName="Facts - delta" partitioningLevelName="" partitioningType="NONE" newGeneration="true" dataTableId="aea29582-84e2-4ef4-a169-5d9549141ba6" aggregateDataSourceFacts="false" unresolvedRowsBehavior="ERROR">
<rowFactAggregationType>ADD_ROW</rowFactAggregationType>
<measure name="# changes (based on delta)" aggregationType="SUM">
<rollupHierarchy></rollupHierarchy>
<dataColumn name="delta"/>
<cellProperties></cellProperties>
<emptyIsZero>false</emptyIsZero>
</measure>
<links dimensionId="0c4cf980-73d9-4c42-ae47-a300421c29a2">
<viewLinks type="LAST_LEVEL">
<toColumns name="chg"/>
</viewLinks>
</links>
<links dimensionId="ed48052e-2c11-48a8-9407-c4854b163cb6">
<viewLinks type="LAST_LEVEL">
<toColumns name="phase"/>
</viewLinks>
</links>
<links dimensionId="b545bf65-ec47-4267-a4f1-a8df35096bc4">
<viewLinks type="LAST_LEVEL">
<toColumns name="date"/>
</viewLinks>
</links>
</defaultFacts>
</cube>
<localization enabled="false"/>
<script>
<content>--
-- Automatically migrated from an old XML file definition format (v2.0.4 or before)
--
--
-- Drop all calc. members, sets and functions declared at schema/cube levels
--
DROP *
--
-- Functions
--
--
-- Sets
--
--
-- Calculated Measures/Members
--
CREATE MEMBER [#changes ITD] as Aggregate( compactSet(NULL:[Time].[Time].currentMember) , [Measures].[# changes (based on delta)] )</content>
</script>
</schemaDefinition>
</schemaFactory>