Solved

SSRS Expression

Posted on 2013-11-21
2
364 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

After much searching across the internet I have found that you could not set the name of the file you were attaching to dynamic report subscriptons in Microsoft Reporting Services. I did manage to find one article showing you how your could make a s…
How to use Variables  and Custom code in SSRS report and Assembly reference to use compile shared code in SSRS. Its big question for all who are working with SSRS. It is easy to create assembly and refer in SSRS report, still there are some steps…
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…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

734 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