SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Analysis Server and Reporting Services (2008)
 conditional formatting in SSRS for trending report
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

sachingovekar
Yak Posting Veteran

98 Posts

Posted - 07/08/2013 :  09:50:50  Show Profile  Reply with Quote
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

India
52309 Posts

Posted - 07/08/2013 :  12:19:39  Show Profile  Reply with Quote

;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


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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000