Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Last Three Row Expand / Collapse
Author
Message
Posted Monday, November 4, 2013 2:30 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Monday, June 9, 2014 1:21 AM
Points: 58, Visits: 191
Goal:
Select the last tree row in a detailed list.

Problem:
How should I do it?

Information:
*The data source is SSAS.
Post #1511302
Posted Tuesday, November 5, 2013 2:46 AM


SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Friday, July 25, 2014 7:47 AM
Points: 83, Visits: 682
You can use the Tail function.

e.g.

SELECT 
NON EMPTY { [Measures].[Order Count] } ON COLUMNS,
TAIL( [Sales Territory].[Sales Territory Region].Children,3) ON ROWS
FROM
[Adventure Works]
CELL PROPERTIES VALUE

If you wanted to order the set so, e.g. the three lowest counts, you can use order as well.

SELECT 
NON EMPTY { [Measures].[Order Count] } ON COLUMNS,
TAIL(
ORDER([Sales Territory].[Sales Territory Region].Children, [Measures].[Order Count], DESC)
,3) ON ROWS
FROM
[Adventure Works]
CELL PROPERTIES VALUE

Post #1511407
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse