简体   繁体   English

SSRS每日订阅每月报告

[英]SSRS daily subscription for monthly report

I have a SSRS report which is executed and delivered daily to emails. 我有一个SSRS报告,每天都会执行并发送到电子邮件中。 The report calculates some numbers for the 1st date of the month to the (d-1)th date (d being the day when it is executed). 该报告计算从月份的第一个日期到第(d-1)个日期(d是执行日期)的一些数字。 So the default parameter values in this report are : 因此,此报告中的默认参数值为:

  • Start_date :=DateSerial(Year(Date.Now), Month(Date.Now), 1) 开始日期:= DateSerial(年(日期。现在),月(日期。现在),1)
  • End_date :=DateAdd("d",-1,Today()) 结束日期:= DateAdd(“ d”,-1,Today())

The problem is on 1st of every new month , the start date evaluates to 1st of new month and the end date becomes the last date of previous month . 问题出在每个新月的1号,开始日期计算为新月的1号,结束日期成为上个月的最后日期 This makes the report non-sensical on 1st of every month. 这使得该报告在每个月的1日变得毫无意义。 What should we do to avoid this and force the expression to evaluate 1st of the new month as start and end date ? 我们应该如何避免这种情况,并迫使表达式将新月的1号作为开始日期和结束日期?

For the End Date, perhaps check if it's the 1st of the month and then default to the current date (ie the 1st) if it is: 对于“结束日期”,也许检查一下它是否是月份的第一天,如果是,则默认为当前日期(即第一天):

=Iif(
    Day(DateTime.Today) = 1,
    DateTime.Today,
    DateAdd("d",-1,DateTime.Today)
    )

But I'm assuming there is a reason your are using today-1 as the end date, so this could mean your report shows nothing for the 1st day of the month... 但是我假设您将“ today-1”用作结束日期是有原因的,所以这可能意味着您的报告在当月的第一天没有任何显示...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM