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 04, 2013 2:30 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Tuesday, January 28, 2014 6:47 AM
Points: 56, Visits: 184
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 05, 2013 2:46 AM


SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Wednesday, April 02, 2014 5:58 AM
Points: 75, Visits: 624
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