Solved

Top N filter for an MDX DataSet in Reporting Services

Posted on 2004-08-18
3
746 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

628 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