How to get values for current quarter - expression

  • I know, it's been a while!

    So I need to get the sum of the current quarter for some types of data (basically the quarter of the current month).

    I did research and got this expression:

    =sum(iif(Fields!FULLDATE.Value >= DateAdd("d",-1,DateAdd("q",1,DateSerial(Year(Now()), (3*DatePart("q",Now()))-2, 1))),

    iif(Fields!FULLDATE.Value < DateAdd("d",-1,DateAdd("q",1,DateSerial(Year(Now()), (3*DatePart("q",Now()))-2, 1)))), Fields!GA_VISITS.Value, 0),0))

    However an error:

    The value expression for textrun '' has a scope parameter that is not valid for an aggregate function.

    So I haven't tried using the lookup function but would this be the way to go versus this way? I have used that before for something else, not tried it here yet.

    Thanks for any help.

  • That expression looks mighty complicated.

    Something like this should work:

    =Sum(Iif(Year(Fields!FULLDATE.Value) & "-" & DatePart(DateInterval.Quarter,Fields!FULLDATE.Value) = Year(Now()) & "-" & DatePart(DateInterval.Quarter,Now()),Fields!GA_VISITS.Value, 0))

  • You know, I was playing around with Quarter but couldn't get it to work. Literally thank you SO much, I was partway there with what you have given me it was getting the data correctly.

    Worked first time!

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply