Solved

Top N filter for an MDX DataSet in Reporting Services

Posted on 2004-08-18
3
739 Views
Last Modified: 2008-01-09
Reporting Services: Can you please tell me how do I use the filter option from the DataSource tab in order to retrieve the top N records from the dataset.

I tried several ways, see below, none of them work, I keep getting the error that "cannot evaluate filterx expression/filter values".

<DataSets>
    <DataSet Name="FoodMart_2000">
      <Fields>
        <Field Name="Category_Category_Description">
          <DataField>[Category].[Category Description].[MEMBER_CAPTION]</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="Measures_Amount">
          <DataField>[Measures].[Amount]</DataField>
        </Field>
      </Fields>
      <Filters>
        <Filter>
          <FilterExpression>=RowNumber()</FilterExpression>
          <Operator>TopN</Operator>
          <FilterValues>
            <FilterValue>2</FilterValue>
          </FilterValues>
        </Filter>
      </Filters>
      <Query>
        <DataSourceName>FoodMart 2000</DataSourceName>
        <CommandText>select
{[Measures].[Amount]} on columns,
{[Category].[Category Description].Members} on rows
FROM
Budget</CommandText>
      </Query>
    </DataSet>

or with:

       <Filter>
          <FilterExpression>=Fields!Category_Category_Description.Value</FilterExpression>
          <Operator>TopN</Operator>
          <FilterValues>
            <FilterValue>2</FilterValue>
          </FilterValues>
        </Filter>

0
Comment
Question by:lentzi
3 Comments
 

Author Comment

by:lentzi
ID: 11900501
Found the answer on Microsoft's forum, but I will leave it here for the others:
<Filter>
          <FilterExpression>=Fields!Category_Category_Description.Value</FilterExpression>
          <Operator>TopN</Operator>
          <FilterValues>
            <FilterValue>=2</FilterValue>
          </FilterValues>
        </Filter>
0
 
LVL 1

Accepted Solution

by:
DarthMod earned 0 total points
ID: 12142695
Submitted to PAQ with points refunded (500)

DarthMod
Community Support Moderator
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
t-sql need help on t-sql 10 25
TSQL Challenge... 7 35
how to just get time from a date 6 32
too many installs coming along with SQL 2016? 1 14
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question