SSRS条件选择表达式
我有一个SQL SSRS报告,该报告根据选定的日期范围获取数据。
有两个日期参数: 来自 直到
我需要根据报告运行的一周日期自动填写的日期和日期才能自动填写。
- 如果是星期一,那么日期应该是上一周和日期的星期一,应该是上周的星期日。
- 如果是星期二,那么日期应为周一和日期,直到星期二,等等 - 星期三(星期一至周三),星期四(星期一至周四)...
或者也许对于第2点,仅仅是有意义的有一个表达方式,即如果是星期二,请选择周一至周日的整个星期,因为未来的日期根本不会返回任何数据,而SSR允许选择未来的日期?
谢谢你!
I have a sql ssrs report which takes data based on selected date range.
There's 2 date parameters:
date from
date till
I need the date from and date till to fill in automatically based on which date of the week it is when the report is run.
- If it's monday, then the date from should be the monday of previous week and date till should be the sunday of previous week.
- If it's tuesday, then the date from should be current week Monday and date till should be Tuesday and so on - Wednesday (Monday to Wednesday), Thursday (Monday to Thursday)...
Or perhaps for point 2 it would make sense to just have an expression that if it's tuesday, then select the whole current week monday to sunday as future dates simply won't return any data anyway and SSRS allows to select future dates?
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在参数上的默认值上这些表达式:
日期:
日期到:
datepart(“ W”,今天)从周日开始,这就是为什么星期一将是2
You can these expression on the default value on your parameters:
date from:
date till:
DatePart("w", Today) begins on sunday that's why monday would be 2