Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««123»»

SSRS Indicators Expression Expand / Collapse
Author
Message
Posted Friday, September 21, 2012 7:04 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, December 24, 2013 4:56 AM
Points: 178, Visits: 668

Still doesn't work, I have this so far:

=SWITCH
(
LAST(Fields!Value.Value, "DataSet1") = 0, 0,
(FIRST(Fields!Value.Value, "DataSet1") >= LAST(Fields!Expr2.Value, "DataSet1")),3,
(FIRST(Fields!Value.Value, "DataSet1") / LAST(Fields!Expr2.Value, "DataSet1")), >= 0.7, 2,
(FIRST(Fields!Value.Value, "DataSet1") / LAST(Fields!Expr2.Value, "DataSet1")) < 0.7, 1
)

The error: 'syntax error' - underlined above
What do you detect here?
Post #1362637
Posted Friday, September 21, 2012 7:10 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Monday, October 13, 2014 6:42 AM
Points: 5,216, Visits: 5,111
You have brackets around the expression, they arn't needed on that line.



Want an answer fast? Try here
How to post data/code for the best help - Jeff Moden
Need a string splitter, try this - Jeff Moden
How to post performance problems - Gail Shaw
CrossTabs-Part1 & Part2 - Jeff Moden
SQL Server Backup, Integrity Check, and Index and Statistics Maintenance - Ola Hallengren
Managing Transaction Logs - Gail Shaw
Troubleshooting SQL Server: A Guide for the Accidental DBA - Jonathan Kehayias and Ted Krueger

Post #1362645
Posted Friday, September 21, 2012 7:16 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, December 24, 2013 4:56 AM
Points: 178, Visits: 668

Great!
OK and about the changes I've done with 'Expr2'?
But I must be doing something wrong in the indicator state property with the colors expression.
Illuminate me here.

Thanks
Post #1362651
Posted Friday, September 21, 2012 7:23 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Monday, October 13, 2014 6:42 AM
Points: 5,216, Visits: 5,111
I have attached a sample report based on your initial data which colours the indicator in Red due to the value it calculates.



Want an answer fast? Try here
How to post data/code for the best help - Jeff Moden
Need a string splitter, try this - Jeff Moden
How to post performance problems - Gail Shaw
CrossTabs-Part1 & Part2 - Jeff Moden
SQL Server Backup, Integrity Check, and Index and Statistics Maintenance - Ola Hallengren
Managing Transaction Logs - Gail Shaw
Troubleshooting SQL Server: A Guide for the Accidental DBA - Jonathan Kehayias and Ted Krueger

Post #1362655
Posted Friday, September 21, 2012 7:46 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, December 24, 2013 4:56 AM
Points: 178, Visits: 668

Thanks!
And what if there's more than one value in the value column?
For example: For Allocation I have at least 2 values (2 different funding sources).
Solutions for this example?

Post #1362675
Posted Friday, September 21, 2012 7:51 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Monday, October 13, 2014 6:42 AM
Points: 5,216, Visits: 5,111
Thats why I asked if there will only ever be two rows in the table on the first post.

If you have more than 1 set of values in the table, then you will need to have a different table layout, where allocation and value planned are in the same row.

Then remove all the FIRST and LAST from the expressions and subsitute the right fields into the expressions.

E.g

Table
AllocationValue, PlannedValue
1000000, 10000000000000
10564198, 1848915614894

Would end up an expression something like the following

=SWITCH
(
Fields!PlannedValue.Value = 0, 0,
Fields!AllocationValue.Value >= Fields!PlannedValue.Value, 3,
(Fields!AllocationValue.Value / Fields!PlannedValue.Value) >= 0.7, 2
(Fields!AllocationValue.Value / Fields!PlannedValue.Value) < 0.7, 1
)




Want an answer fast? Try here
How to post data/code for the best help - Jeff Moden
Need a string splitter, try this - Jeff Moden
How to post performance problems - Gail Shaw
CrossTabs-Part1 & Part2 - Jeff Moden
SQL Server Backup, Integrity Check, and Index and Statistics Maintenance - Ola Hallengren
Managing Transaction Logs - Gail Shaw
Troubleshooting SQL Server: A Guide for the Accidental DBA - Jonathan Kehayias and Ted Krueger

Post #1362680
Posted Friday, September 21, 2012 8:13 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, December 24, 2013 4:56 AM
Points: 178, Visits: 668

Ok, Thanks.

I got this:

=SWITCH
(
(Fields!Expr2.Value, "DataSet1") = 0, 0,
(Fields!Value.Value, "DataSet1") >= (Fields!Expr2.Value, "DataSet1"), 3,
(Fields!Value.Value, "DataSet1") / (Fields!Expr2.Value, "DataSet1") >= 0.7, 2,
(Fields!Value.Value, "DataSet1") / (Fields!Expr2.Value, "DataSet1") < 0.7, 1
)

It returns me an error: [BC30198] ')' expected

What am I doing wrong?

Thanks
Post #1362693
Posted Friday, September 21, 2012 8:19 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Monday, October 13, 2014 6:42 AM
Points: 5,216, Visits: 5,111
Unsure, looks right, only thing I can think of is to enclose the last two in brackets, so the division is done before the evaluation


=SWITCH
(
(Fields!Expr2.Value, "DataSet1") = 0, 0,
(Fields!Value.Value, "DataSet1") >= (Fields!Expr2.Value, "DataSet1"), 3,
((Fields!Value.Value, "DataSet1") / (Fields!Expr2.Value, "DataSet1")) >= 0.7, 2,
((Fields!Value.Value, "DataSet1") / (Fields!Expr2.Value, "DataSet1")) < 0.7, 1
)




Want an answer fast? Try here
How to post data/code for the best help - Jeff Moden
Need a string splitter, try this - Jeff Moden
How to post performance problems - Gail Shaw
CrossTabs-Part1 & Part2 - Jeff Moden
SQL Server Backup, Integrity Check, and Index and Statistics Maintenance - Ola Hallengren
Managing Transaction Logs - Gail Shaw
Troubleshooting SQL Server: A Guide for the Accidental DBA - Jonathan Kehayias and Ted Krueger

Post #1362697
Posted Friday, September 21, 2012 8:26 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, December 24, 2013 4:56 AM
Points: 178, Visits: 668

Doesn't work, already tried that way.
You any solution?
Post #1362708
Posted Friday, September 21, 2012 8:30 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Monday, October 13, 2014 6:42 AM
Points: 5,216, Visits: 5,111
Only thing I can suggest is to attach the RDL file along with some sample data and I will give it a go here.



Want an answer fast? Try here
How to post data/code for the best help - Jeff Moden
Need a string splitter, try this - Jeff Moden
How to post performance problems - Gail Shaw
CrossTabs-Part1 & Part2 - Jeff Moden
SQL Server Backup, Integrity Check, and Index and Statistics Maintenance - Ola Hallengren
Managing Transaction Logs - Gail Shaw
Troubleshooting SQL Server: A Guide for the Accidental DBA - Jonathan Kehayias and Ted Krueger

Post #1362712
« Prev Topic | Next Topic »

Add to briefcase ««123»»

Permissions Expand / Collapse