Solved

SSRS Expression

Posted on 2013-11-21
2
363 Views
Last Modified: 2013-12-10
Hi,

I am trying to set a default parameter value in SSRS.

I have two columns in a dataset, "Year" and "MonthNo". I would like the expression to return the maximum "MonthNo" where the "Year" is equal to the maximum "Year". I do not want to do this as a separate SQL query.

Thanks, Greg
0
Comment
Question by:spen_lang
[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
2 Comments
 
LVL 37

Accepted Solution

by:
ValentinoV earned 500 total points
ID: 39668796
"I do not want to do this as a separate SQL query."

Then you'll not like my answer but a new SQL query is your only option.  For the simple reason that expressions to set the default value of a report parameter do not allow any dataset field references, unfortunately...
0
 
LVL 65

Expert Comment

by:Jim Horn
ID: 39668809
^^^ adding to VV ^^^

It is a common practice with reports that anything resembling 'business logic' be in the database T-SQL, and not in the report file itself.
It's easier to maintain in the database should those rules change
If other reports can use it it can be made a function called multiple times (i.e. 'component').
0

Featured Post

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

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

Introduction: This article is aimed at report developers who are used to developing reports using relational databases and have gotten a first-time assignment to develop reports on OLAP cubes. It demonstrates how to build a report using SQL Ser…
Have you ever had to extract data from a Microsoft SQL Server database and export it to an Excel file, but did not want to use a DTS package? The concept in this article is not new, but it is the answer and will also work on 64-bit SQL boxes.   …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

735 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