水晶报告 - 上个月的最后一天

时间:2022-08-28 20:18:42

I was given this formula in a program, but it's giving me the first of the current month. I need to get the last day of the previous month, so report runs the 3rd day of current month we want only the previous month data.

我在一个程序中得到了这个公式,但它给了我本月的第一个。我需要获取上个月的最后一天,因此报告运行当月的第3天,我们只需要上个月的数据。

ToNumber(ToText(Year(CurrentDate), 0, "") + ToText(Month(CurrentDate), "00") + '01')

4 个解决方案

#1


1  

you could use

你可以用

{datefield} in lastfullmonth

or if you just need that last day

或者如果你只需要最后一天

date(year(currentdate),month(currentdate),1)-1

#2


0  

Does this give you what you need?

这能满足您的需求吗?

select DATEADD(MONTH, DATEDIFF(MONTH, -1, GETDATE())-1, -1)

#3


0  

Use the CDLASTDAYOFMONTH function along with the usual month/date functions

使用CDLASTDAYOFMONTH函数以及通常的月/日函数

CDLASTDAYOFMONTH(Month(DateAdd ("m", -1, CurrentDate))); 

#4


0  

This should work.

这应该工作。

maximum(Lastfullmonth)

#1


1  

you could use

你可以用

{datefield} in lastfullmonth

or if you just need that last day

或者如果你只需要最后一天

date(year(currentdate),month(currentdate),1)-1

#2


0  

Does this give you what you need?

这能满足您的需求吗?

select DATEADD(MONTH, DATEDIFF(MONTH, -1, GETDATE())-1, -1)

#3


0  

Use the CDLASTDAYOFMONTH function along with the usual month/date functions

使用CDLASTDAYOFMONTH函数以及通常的月/日函数

CDLASTDAYOFMONTH(Month(DateAdd ("m", -1, CurrentDate))); 

#4


0  

This should work.

这应该工作。

maximum(Lastfullmonth)