Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Analysis Server and Reporting Services (2005)
 Using Top N and Bottom N within same report

Author  Topic 

doodles
Starting Member

8 Posts

Posted - 2011-02-09 : 09:55:52
Hi all

I've built a report that has two tables, one showing the top 5 sales per region, the other showing bottom 5 sales per region. Each tables is bound to a different dataset, each dataset has a filter (one for top N and the other for bottom N).

This works fine, however, I want to add a report parameter to allow the user to choose the product for which they want to view the top 5/bottom 5 sales per region. When they change the parameter and click View Report, this should update both tables (top and bottom). At the moment this is only updating the top 5 table, not the bottom 5. Obviously I don't want to have two parameter drop-downs on the report...

Anyone know how I can do this? Do i need to perhaps try populating a second - but hidden - report parameter based on the selection of the first so that the second table can get updated as well?

Any assistance is appreciated!

Thanks
Doodles

theboyholty
Posting Yak Master

226 Posts

Posted - 2011-02-22 : 12:09:58
If you have two separate datasets, one for TOP N and one for bottom N, then if you have named the parameters the same (remember that its case sensitive), then changing ther main report parameter should affect both datasets.

If this doesn't help, you could post your code and we could take a look at it.

---------------------------------------------------------------------------------
http://www.mannyroadend.co.uk The official unofficial website of Bury Football Club
Go to Top of Page

doodles
Starting Member

8 Posts

Posted - 2011-02-24 : 05:19:36
Thanks for your response.

I got this working a while ago and indeed having the same parameters in both datasets is the solution to this issue.

However I wish there was a way to achieve this without two datasets as it's a pain in the neck having to maintain both datasets. I assume the way would be to modify the mdx query - but i'm an mdx newbie so will take me a while to figure out...

Thanks again!

Doodles
Go to Top of Page

theboyholty
Posting Yak Master

226 Posts

Posted - 2011-02-25 : 06:36:21
Of course, having two datasets doesn't neccessarily mean you need two SPs.
You could have an additional parameter in your SP for TopN or BottomN and then pass that in manually to each dataset both of which run the same SQL code. That way you only have one SP to maintain. Its a more elegant solution but demands some cunning coding in SQL. I'm a big fan of scaleable code personnally.

---------------------------------------------------------------------------------
http://www.mannyroadend.co.uk The official unofficial website of Bury Football Club
Go to Top of Page

doodles
Starting Member

8 Posts

Posted - 2011-02-25 : 07:30:23
Thanks for the comments :) Unfortunately I am not using SQL, i'm using MDX! Will have to spend some time learning the syntax...
Go to Top of Page
   

- Advertisement -