Returns a descending sorted set which cumulative sum is greater or equal than the specified 'sum' value.
In our example we return the two members [3],[2] as their value meets the requested 5 value and one member less would not be enough to reach 5.
Query
WITH
MEMBER [Geography].[Geo].[1] AS 1.0
MEMBER [Geography].[Geo].[2] AS 2.0
MEMBER [Geography].[Geo].[3] AS 3.0
SELECT
TopSum( {[Geography].[Geo].[1],[Geography].[Geo].[2],[Geography].[Geo].[3]},5, [Measures].[Amount] ) ON 0
FROM
[Sales]
Result
Assertion : Cell Equals
WITH
MEMBER [Geography].[Geo].[2] AS 2.0
MEMBER [Geography].[Geo].[3] AS 3.0
SELECT
{[Geography].[Geo].[3],[Geography].[Geo].[2]} ON 0
FROM
[Sales]
If the specified sum is greater than the total sum then all members will be returned.
Query
WITH
MEMBER [Geography].[Geo].[1] AS 1.0
MEMBER [Geography].[Geo].[2] AS 2.0
MEMBER [Geography].[Geo].[3] AS 3.0
SELECT
TopSum( {[Geography].[Geo].[1],[Geography].[Geo].[2],[Geography].[Geo].[3]}, 100, [Measures].[Amount] ) ON 0
FROM
[Sales]
Result
Assertion : MDX Equals
WITH
MEMBER [Geography].[Geo].[1] AS 1.0
MEMBER [Geography].[Geo].[2] AS 2.0
MEMBER [Geography].[Geo].[3] AS 3.0
SELECT
{[Geography].[Geo].[3],[Geography].[Geo].[2],[Geography].[Geo].[1]} ON 0
FROM
[Sales]
This function returns at least one member even though its value is greater than the parameter.
Query
WITH
MEMBER [Geography].[Geo].[1] AS 1.0
MEMBER [Geography].[Geo].[2] AS 2.0
MEMBER [Geography].[Geo].[3] AS 3.0
SELECT
TopSum( {[Geography].[Geo].[1],[Geography].[Geo].[2],[Geography].[Geo].[3]}, 0, [Measures].[Amount] ) ON 0
FROM
[Sales]
Result
Assertion : MDX Equals
WITH
MEMBER [Geography].[Geo].[3] AS 3.0
SELECT
{[Geography].[Geo].[3]} ON 0
FROM
[Sales]
Query
WITH
MEMBER [Geography].[Geo].[1] AS 1.0
MEMBER [Geography].[Geo].[2] AS 2.0
SELECT
TopSum( { [Geography].[Geo].[2], [Geography].[Geo].[1], [Geography].[Geo].[2] }, 4, [Measures].[Amount] ) ON 0
FROM
[Sales]
Result
Assertion : Cell Equals
WITH
MEMBER [Geography].[Geo].[2]AS 2.0
SELECT
{ [Geography].[Geo].[2], [Geography].[Geo].[2] } ON 0
FROM
[Sales]