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


Filter a Matrix


Filter a Matrix

Author
Message
marty.seed
marty.seed
SSCrazy
SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)

Group: General Forum Members
Points: 2061 Visits: 221
Is it possible to filter a matrix so that if a value is over a certain amount the whole row will not show?

For example
VZW West Build Plan
Yearly Sales
Salesman 2012 2013 2014 2015 2016
1 11 20 51 26 23
2 1 23 32 23 34
3 34 43 23 34 12


We need to exclude all records from the report where a salesman has a yearly sale of >=50. As the years are dynamic we would like to handle this in the RDL rather than in the SQL
sgmunson
sgmunson
SSC Guru
SSC Guru (98K reputation)SSC Guru (98K reputation)SSC Guru (98K reputation)SSC Guru (98K reputation)SSC Guru (98K reputation)SSC Guru (98K reputation)SSC Guru (98K reputation)SSC Guru (98K reputation)

Group: General Forum Members
Points: 98214 Visits: 7257
SQL is the considerably better spot for it. If you have a GROUP BY in your query, you would just add a HAVING clause that specifies that all the SUMs are > 50. Even if your query is dynamic SQL, you would already have to have the field list to do so, thus adding another snippet that takes each field and adds it to the HAVING clause isn't all that difficult. As you may have already discovered, trying to filter that matrix isn't going to work so well.

Steve
‌(aka sgmunson)
Smile Smile Smile
Health & Nutrition
sgmunson
sgmunson
SSC Guru
SSC Guru (98K reputation)SSC Guru (98K reputation)SSC Guru (98K reputation)SSC Guru (98K reputation)SSC Guru (98K reputation)SSC Guru (98K reputation)SSC Guru (98K reputation)SSC Guru (98K reputation)

Group: General Forum Members
Points: 98214 Visits: 7257
Another idea occurs to me though... have you tried using an expression to control ROW visibility? Just be aware that it won't exclude the values from any totals that might be there for a given column, so that might not be a particularly good method, and it would largely prevent you from easily creating totals later, if a change in need comes along.

Steve
‌(aka sgmunson)
Smile Smile Smile
Health & Nutrition
marty.seed
marty.seed
SSCrazy
SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)

Group: General Forum Members
Points: 2061 Visits: 221
The visibility won't work because it will display when dumped to excel. Was hoping there was a filter trick on the group in SSRS but will manipulate the SQL to exclude. Thanks for the assistance sgmunson! Appreciate it.
sgmunson
sgmunson
SSC Guru
SSC Guru (98K reputation)SSC Guru (98K reputation)SSC Guru (98K reputation)SSC Guru (98K reputation)SSC Guru (98K reputation)SSC Guru (98K reputation)SSC Guru (98K reputation)SSC Guru (98K reputation)

Group: General Forum Members
Points: 98214 Visits: 7257
marty.seed - Friday, September 29, 2017 1:10 PM
The visibility won't work because it will display when dumped to excel. Was hoping there was a filter trick on the group in SSRS but will manipulate the SQL to exclude. Thanks for the assistance sgmunson! Appreciate it.

Glad I could help.


Steve
‌(aka sgmunson)
Smile Smile Smile
Health & Nutrition
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