Last Three Row

  • Goal:

    Select the last tree row in a detailed list.

    Problem:

    How should I do it?

    Information:

    *The data source is SSAS.

  • 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

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply