Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Analysis Server and Reporting Services (2008)
 conditional formatting in SSRS for trending report

Author  Topic 

sachingovekar
Posting Yak Master

101 Posts

Posted - 2013-07-08 : 09:50:50
Hi,

I have a table with date and numeric values.

Want to display the table as below with formatting in SSRS

5/31/2013 1000 --- this will be green
5/23/2013 900 --- this will be red
4/20/2013 567 --- this will be red
4/10/2013 5000 --- this will be green
3/15/2013 3500 --- this will be blue
2/14/2013 3500

basically my report is a trending report where I will compare current value with previous values and apply formatting.
The formatting idea is to check when there was a drop in figures and when increased by date.

Regards,
Sachin

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-07-08 : 12:19:39
[code]
;With CTE
AS
(
SELECT ROW_NUMBER() OVER (ORDER BY datefield) AS Seq,*
FROM table
)
SELECT t.*,
CASE WHEN t.value > t1.value THEN 'Increase'
WHEN t.value < t1.value THEN 'Decrease'
WHEN t.Value = t1.Value THEN 'No Change'
ELSE 'NA'
END AS Trend
FROM Table t
LEFT JOIN table t1
ON t1.Seq = t.Seq-1
[/code]

Then use this field in Report cell property expression for color like
=Switch(Fields!Trend.value = "Increase","green",Fields!Trend.value ="Decrease","red",Fields!Trend.value ="No Change","White")

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -