Last Month

MONTH ([InvoicedDate]) = MONTH (TODAY ())

The above expression gives ma data for the current month based on [InvoicedDate].

What would be the expression to return data from Last month again based on [InvoicedDate] ?

Thanks

Dave_Willett:

MONTH ([InvoicedDate]) = MONTH (TODAY ())

MONTH ([InvoicedDate]) = MONTH (TODAY ())-1

2 Likes

Chris_Jeal:

MONTH ([InvoicedDate]) = MONTH (TODAY ()) -1

So easy…
I had tried: MONTH ([InvoicedDate]) = MONTH (TODAY ()-1)

Thank You

1 Like

I believe , if you wish the records to be returned for previous month of December ( Month number 12) in the month of January (Month number 1) next year, then the expression needs to be something like

IF(MONTH(TODAY())-1=0, AND(MONTH ([InvoiceDate])=12, YEAR([InvoiceDate])=YEAR(TODAY())-1) , MONTH ([InvoiceDate]) = MONTH (TODAY ())-1)

This is so because I believe in the month of January the expression MONTH (TODAY ()-1) will return 0 , instead of 12

2 Likes

I believe @Suvrutt_Gurjar is correct in their assessment. You would want to be careful arbitrarily subtracting from just the month value as it could result in undesired results. Rather use the full date initially. I would suggest possibly exploring the EOMONTH([InvoiceDate], -1) function. I am not sure if the second parameter of the EOMONTH() function will take a negative value but it is worth a try.

4 Likes

Suvrutt_Gurjar:

IF(MONTH(TODAY())-1=0, AND(MONTH ([InvoiceDate])=12, YEAR([InvoiceDate])=YEAR(TODAY())-1) , MONTH ([InvoiceDate]) = MONTH (TODAY ())-1)

Thank you Suvrutt
Works a treat and understoof over month-1 would revert to 0.

1 Like

Try:

(EOMONTH([InvoicedDate], 0) = EOMONTH(TODAY(), -1))

See also:

4 Likes

Nice. Very efficient @Steve. EOMONTH() is really powerful.

There is always great learning on writing compact expressions from you and @Aleksi

1 Like

Thank you guys for the continued support. Appsheet is just the best…

2 Likes