Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

SSRS Expression

Posted on 2013-11-21
2
Medium Priority
?
375 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
2 Comments
 
LVL 37

Accepted Solution

by:
ValentinoV earned 2000 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 66

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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

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.   …
This code started out as a fix for a customer that had incoming data that was hunderds of numbers and words long that was to fit in one column. The problem was that the customer did not want to split words or numbers when wrapping in the column. …
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Loops Section Overview

916 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