1

In the report I'm working on, the user enters a begin date and an end date. Typically, the two will span two weeks, such as if they enter 5/15/2016 for the begin date and 5/28/2016 for the end date.

What I need to show in column headings are the first week over one column (which, in the case above, would be 5/15 - 5/21/16) and the second week over another (which would be in this case 5/22 - 5/28/16).

To achieve this, what do I need to do in the Textbox Expression properties for these two column headers, assuming the parameter BegDate contains 5/15/2016 and the parameter EndDate contains 5/28/2106?

Pedram
  • 6,256
  • 10
  • 65
  • 87
B. Clay Shannon-B. Crow Raven
  • 8,547
  • 144
  • 472
  • 862

2 Answers2

1

Add a new column to your dataset that contains the first day of the week. You can do this in SQL like this:

DATEADD(DAY, 1-DATEPART(WEEKDAY, @d), @d)

You could also do it as a calculated field in your dataset.

Now you simply refer to this field in your textbox. It could even be a column grouping depending on what you need.

StevenWhite
  • 5,907
  • 3
  • 21
  • 46
1

Try:

First Week:

=Parameters!BegDate.Value & " - " &
DATEADD(DateInterval.Day, 7 - DATEPART(DateInterval.Weekday,Parameters!BegDate.Value), Parameters!BegDate.Value)

Second week:

=DATEADD(DateInterval.Day, -DATEPART(DateInterval.Weekday,Parameters!EndDate.Value)+1, Parameters!EndDate.Value)
& " - " & Parameters!EndDate.Value

Example:

enter image description here

Let me know if this helps.

alejandro zuleta
  • 13,962
  • 3
  • 28
  • 48