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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Analysis Server and Reporting Services (2008)
 return data -7 days
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Aged Yak Warrior

United Kingdom
555 Posts

Posted - 12/17/2012 :  09:16:20  Show Profile  Reply with Quote

I am trying to return the data from the below expression that is the -7 days from the currentdate.

This returns the correct figure for all resolved calls:
=Sum(IIF(Fields!NUMBER_OF_DAYS.Value < 3,1,0),"DataSet1")/Count(Fields!NUMBER_OF_DAYS.Value, "DataSet1")

Can I use a DataAdd like below to give me -7 days and append to the expression? or do I need to use the resolved date field - 7
And DateAdd("d", -7,now())

=Sum(IIF(Fields!NUMBER_OF_DAYS.Value < 3,1,0),"DataSet1")And DateAdd("d", -7,now())
/Count(Fields!NUMBER_OF_DAYS.Value, "DataSet1")

Help appreciated.

Also tried this to no ovail...

=Sum(IIF(Fields!NUMBER_OF_DAYS.Value < 3,1,0), and DateAdd("d", -7,Today()) ,"DataSet1")
/Count(Fields!NUMBER_OF_DAYS.Value, "DataSet1")

and this although it returns a percentage its very low...

=Sum(IIF(Fields!NUMBER_OF_DAYS.Value < 3,1,0) and Fields!LastWeek.Value ,"DataSet1")
/Count(Fields!NUMBER_OF_DAYS.Value, "DataSet1")

Edited by - sz1 on 12/17/2012 10:01:38

Aged Yak Warrior

United Kingdom
555 Posts

Posted - 12/17/2012 :  10:14:47  Show Profile  Reply with Quote
I actually need the previous days figure so trying this:

=Sum(IIF(Fields!NUMBER_OF_DAYS.Value < 3,1,0) and Fields!Yesterday.Value,"DataSet1")
/Count(Fields!NUMBER_OF_DAYS.Value, "DataSet1")

The Yesterday field is built in to the DatMart but it does not return anything near correct, can some one advice on the syntax on this on eplease to be able to calculate the above but for the previous day?

Go to Top of Page

Starting Member

4 Posts

Posted - 01/01/2013 :  11:53:04  Show Profile  Reply with Quote
try comparing your dataset date to getdate()-7. Note this should be done in your stored proc if you have one or in the text script that makes up your dataset
Go to Top of Page

Very Important crosS Applying yaK Herder

52326 Posts

Posted - 01/01/2013 :  23:54:28  Show Profile  Reply with Quote
can you explain what percentage you're trying to calculate here? your current expression doesnt make much sense

SQL Server MVP

Go to Top of Page
  Previous Topic Topic Next 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.02 seconds. Powered By: Snitz Forums 2000