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


SSRS Indicators Expression


SSRS Indicators Expression

Author
Message
davdam8
davdam8
Say Hey Kid
Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)

Group: General Forum Members
Points: 664 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?
anthony.green
anthony.green
SSC-Insane
SSC-Insane (23K reputation)SSC-Insane (23K reputation)SSC-Insane (23K reputation)SSC-Insane (23K reputation)SSC-Insane (23K reputation)SSC-Insane (23K reputation)SSC-Insane (23K reputation)SSC-Insane (23K reputation)

Group: General Forum Members
Points: 23766 Visits: 6519
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
When a question, really isn't a question - Jeff Smith
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


davdam8
davdam8
Say Hey Kid
Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)

Group: General Forum Members
Points: 664 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
anthony.green
anthony.green
SSC-Insane
SSC-Insane (23K reputation)SSC-Insane (23K reputation)SSC-Insane (23K reputation)SSC-Insane (23K reputation)SSC-Insane (23K reputation)SSC-Insane (23K reputation)SSC-Insane (23K reputation)SSC-Insane (23K reputation)

Group: General Forum Members
Points: 23766 Visits: 6519
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
When a question, really isn't a question - Jeff Smith
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


davdam8
davdam8
Say Hey Kid
Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)

Group: General Forum Members
Points: 664 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?
anthony.green
anthony.green
SSC-Insane
SSC-Insane (23K reputation)SSC-Insane (23K reputation)SSC-Insane (23K reputation)SSC-Insane (23K reputation)SSC-Insane (23K reputation)SSC-Insane (23K reputation)SSC-Insane (23K reputation)SSC-Insane (23K reputation)

Group: General Forum Members
Points: 23766 Visits: 6519
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
When a question, really isn't a question - Jeff Smith
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


davdam8
davdam8
Say Hey Kid
Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)

Group: General Forum Members
Points: 664 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
anthony.green
anthony.green
SSC-Insane
SSC-Insane (23K reputation)SSC-Insane (23K reputation)SSC-Insane (23K reputation)SSC-Insane (23K reputation)SSC-Insane (23K reputation)SSC-Insane (23K reputation)SSC-Insane (23K reputation)SSC-Insane (23K reputation)

Group: General Forum Members
Points: 23766 Visits: 6519
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
When a question, really isn't a question - Jeff Smith
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


davdam8
davdam8
Say Hey Kid
Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)Say Hey Kid (664 reputation)

Group: General Forum Members
Points: 664 Visits: 668
Doesn't work, already tried that way.
You any solution?
anthony.green
anthony.green
SSC-Insane
SSC-Insane (23K reputation)SSC-Insane (23K reputation)SSC-Insane (23K reputation)SSC-Insane (23K reputation)SSC-Insane (23K reputation)SSC-Insane (23K reputation)SSC-Insane (23K reputation)SSC-Insane (23K reputation)

Group: General Forum Members
Points: 23766 Visits: 6519
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
When a question, really isn't a question - Jeff Smith
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


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