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)
 return data -7 days

Author  Topic 

sz1
Aged Yak Warrior

555 Posts

Posted - 2012-12-17 : 09:16:20
Hi

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())

SO,
=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.
Thanks

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")

sz1
Aged Yak Warrior

555 Posts

Posted - 2012-12-17 : 10:14:47
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?

Thanks
Go to Top of Page

Matengele
Starting Member

4 Posts

Posted - 2013-01-01 : 11:53:04
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

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

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

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -