Question

I'm not even sure if it's possible to do this, as SSRS has alot of limitations.

Suppose I have two entries in my SQL Table:

Name: John Doe
Value: 20
Month: January 2014

Name: John Doe
Value: 30
Month: February 2014

I'm trying to do some conditional formatting depending on if the value went up or down from the previous month.

Right now I'm grouping on Month. Is there a way to somehow compare the previous value in the grouping to the current one? Something like:

=IIF(Fields!Month.Value < (Fields!Month.Value-1) ) ...

This seems like it would just take the value of the current month and give the month before that.

Thoughts?

EDIT: After trying the 'Previous' command, it is getting closer to what I'm seeking. However... It is comparing fields from other people. (the data is grouped by person, then by month)

For example:

Name: John Doe
Value: 20
Month: January 2014

Name: John Doe
Value: 30 - WOULD BE GREEN BECAUSE 30 > 20
Month: February 2014

Name: Steve Smith
Value: 10 - WILL SHOW RED BECAUSE 10 < 30 (different person)
Month: January 2014

Name: Steve Smith
Value: 20
Month: February 2014
Was it helpful?

Solution

You can do this with the Previous function.

Say I have data like this:

enter image description here

And a table based on this, grouped on month:

enter image description here

I have applied the following expression to one of the textboxes:

=IIf(Previous(Sum(Fields!val.Value), "monthGroup") > Sum(Fields!val.Value)
  , "Red"
  , "Green")

For me the expression editor showed a syntax error, but it ran fine:

enter image description here

You could adapt this for other formatting requirements.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top