Using expressions to break down date ranges

  • Hi,

    Probably a simple one but not having luck at the minute. Am trying to break down date ranges using the Switch statement. Am trying to say:

    Switch(Datediff("d",Fields!ProcessStartDate.Value,Today())<7,"Less than 1 week",(Datediff("d",Fields!ProcessStartDate.Value,Today())>7<=14,"1 to 2 weeks")

    It is defaulting to the "1 to 2 weeks" option in all instances.

    How do I write the more than 7 but less than or equals to 14 in one statement?

    I think that makes sense.........

  • You could use an in-line if statement

    =iif(Datediff("d",Fields!ProcessStartDate.Value,Today()) <=7, "Less than 1 week", iif(Datediff("d",Fields!ProcessStartDate.Value,Today()) <= 14, "1 to 2 weeks", "More than 2 weeks"))

    I've editted your statement slight, as your logic stated value for less than 7 days and, more than 7 days and less than or equal to 14 only. It did not include logic for 7 days, or more than 14. You can edit as you see fit.

    Edit: For some reason < is being converted to &lt; in the code box. You'll have to change these yourself.

    Thom~

    Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
    Larnu.uk

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

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