Quantcast
Channel: SQL Server Reporting Services, Power View forum
Viewing all articles
Browse latest Browse all 10045

Report Builder 3.0 Where clause with CASE statement

$
0
0

I have a drill through report that works well with the main report.  I would like to modify the drill through report but am having trouble with the WHERE clause.  The main report is a summary with different aging buckets and looks like this:

Team             Total                  30             60              90               120

     A                xxxx               xxxx          xxxxx          xxxxx         xxxxx

     B                xxxx               xxxx          xxxx           xxxxx         xxxxx

     C               xxxx                xxxx         xxxx          xxxxx          xxxxx  

The current report only contains hyperlinks on the Team values.  When a user clicks on one of the Teams, the drill through report displays the details for the records that make up the total amount.  Works great.

What I would like to do is to modify the drill through report so the user can select on of the amount fields (30 / 60 /90 /120) for a particular team. 

The current WHERE clause on the drill through report looks like this: "WHERE  a.lgp = Parm1".  Parm1 is the field value for the Team the user selects.

I would like modify the WHERE clause so that it will work if the user selects the team or 1 of the amount fields.  Can I use a CASE statement for this in the WHERE clause? 

If the user selects an amount field the WHERE clause would look something like this for 30 / 60 / 90:

WHERE a.lgp = Parm1 and ar.aging_bucket = Parm2.  Parm2 would be either 1,2, 3.  However, if they select 120, then the WHERE clause would be something like this: a.lgp = Parm1 and ar.aging_bucket =>4.

I could create 3 copies of the drill through report (1) Total, (2) 30 / 60 / 90, and (3) 120 but then I have to maintain 3 reports.  I would rather modify the WHERE clause to handle all 3 of these situations.

Any suggestions would be greatly appreciated.  Thanks for your help.....


Viewing all articles
Browse latest Browse all 10045

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>