SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Filter Group By Total by Parameter


Filter Group By Total by Parameter

Author
Message
cmickley
cmickley
SSC Rookie
SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)

Group: General Forum Members
Points: 34 Visits: 92
I am trying to Filter data on a Group By Total, based on a dropdown param of values. I could do this pretty easily in Crystal.

Please see screen shot for detail. I am trying to Filter data on usage Dropdown, of the Subtotal field.

Thanks for any help!
Charles
Attachments
FilterByParam.jpg (17 views, 65.00 KB)
RSCERO
RSCERO
SSC Rookie
SSC Rookie (46 reputation)SSC Rookie (46 reputation)SSC Rookie (46 reputation)SSC Rookie (46 reputation)SSC Rookie (46 reputation)SSC Rookie (46 reputation)SSC Rookie (46 reputation)SSC Rookie (46 reputation)

Group: General Forum Members
Points: 46 Visits: 143
In your query, you should be able to do something like the following:

@ParmValue = passed in parm value

Select
ID
,sum(value) as ValueOut
from
Table
group by
ID
having
sum(value) <= @ParmValue



cmickley
cmickley
SSC Rookie
SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)

Group: General Forum Members
Points: 34 Visits: 92
RSCERO, I can try this, but I figured there should be the ability to do this via Row filtering where you could set this via the Group properties via the Row.
RSCERO
RSCERO
SSC Rookie
SSC Rookie (46 reputation)SSC Rookie (46 reputation)SSC Rookie (46 reputation)SSC Rookie (46 reputation)SSC Rookie (46 reputation)SSC Rookie (46 reputation)SSC Rookie (46 reputation)SSC Rookie (46 reputation)

Group: General Forum Members
Points: 46 Visits: 143
Look at the dataset filter option. You can filter the returned results there using parameter values, or you can use the filter options in the table Group definintion. It sounds like you want to do this in the table, so the group definition is proably the best place for it.



cmickley
cmickley
SSC Rookie
SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)

Group: General Forum Members
Points: 34 Visits: 92
OK, I have tried about every type of filtering I can do, and can't get this to work.

I've put a filter on the Dataset, but get an error on that, that I cannot use Agregate functions on dataset filters or data region filters.

I have added a filter on the GroupBy, and the Tablix table, but do not get errors, it just does not return correct values. It does not filter it at all.

FYI, I am using SSRS2008. Can you give me an exact example or demo?

thanks
Charles
RSCERO
RSCERO
SSC Rookie
SSC Rookie (46 reputation)SSC Rookie (46 reputation)SSC Rookie (46 reputation)SSC Rookie (46 reputation)SSC Rookie (46 reputation)SSC Rookie (46 reputation)SSC Rookie (46 reputation)SSC Rookie (46 reputation)

Group: General Forum Members
Points: 46 Visits: 143
Couple of things, first look at your parameters, they seem a bit confusing:

I think this is what you are looking to filter on:
>= 0 - All in (Parm.Value =0)
< 2 - 0 or 1 (Parm.Value=1)
>= 2 - more than 1 (Parm.Value=2)

I used the following in the visibility property of the row to hide rows based on the selected parm.

=switch(
Parameters!Usage.Value=0 ,False,
Parameters!Usage.Value=1 and sum(Fields!UsageCnt.Value) < 2,False,
Parameters!Usage.Value=2 and sum(Fields!UsageCnt.Value) > 1,False,
1=1,True)

I did this in RS2008



cmickley
cmickley
SSC Rookie
SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)

Group: General Forum Members
Points: 34 Visits: 92
I think this might work, it seems to be so far.. I just am seeing a couply screwy results, but with adding the same "visible" functionality on GroupBy and Detail rows, it is working good.

Thanks for your help on this.
Charles
cmickley
cmickley
SSC Rookie
SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)

Group: General Forum Members
Points: 34 Visits: 92
RSCERO, what does the "1=1" part of the expression do?
cmickley
cmickley
SSC Rookie
SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)

Group: General Forum Members
Points: 34 Visits: 92
So I have included a small snippet of my data run on this report in .xls. The first Param(All In) and the 3 param(More than 1) seems to work file and make data visible correctly and the Sum field is fine. But when you choose the 2nd option (0 or 1), the Sum(Points1) field does not calculate correctly then.

Any idea why?
Attachments
ReportTest.xls (11 views, 37.00 KB)
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search