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.
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 SSRS5/31/2013 1000 --- this will be green5/23/2013 900 --- this will be red4/20/2013 567 --- this will be red4/10/2013 5000 --- this will be green3/15/2013 3500 --- this will be blue2/14/2013 3500basically 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 CTEAS(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 TrendFROM Table tLEFT JOIN table t1ON 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 MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|