Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Shahzad_Ahsan
Creator III
Creator III

How to get next 30 days from Today

Hi Everyone

I have Items table with Expiry Date. I want, Count of items whose expiry is in next 30 days.

1 Solution

Accepted Solutions
YoussefBelloum
Champion
Champion

EDITED

and maybe add an >= part:

Count({<ExpiryDate={"<=$(=date(addMonths(today(1),1),'The format of ur ExpiryDate field'))>=$(=Date(today(),'The format of ur ExpiryDate field'))"}>}distinct Items)


otherwise it will take all the ExpiryDates even those < today, so it will no longer be on (next 30 days)

View solution in original post

9 Replies
OmarBenSalem

Maybe sthing like :

Translate: count distinct items which expiryDate <= today + 1 month

count({<ExpiryDate={"<=$(=date(addMonths(today(1),1),'The format of ur ExpiryDate field')"}>}distinct Items)

sunny_talwar

I think you missed a closing parenthesis

Count({<ExpiryDate={"<=$(=date(addMonths(today(1),1),'The format of ur ExpiryDate field'))"}>}distinct Items)

OmarBenSalem

Yes, my bad ! that because I've added the date() in the last minute

sunny_talwar

Make sense

Shahzad_Ahsan
Creator III
Creator III
Author

Hi Omar and Sunny

Thanks for your response

This is not giving the exact result. This showing all upcoming expiry.

I have attached sample for you.

YoussefBelloum
Champion
Champion

EDITED

and maybe add an >= part:

Count({<ExpiryDate={"<=$(=date(addMonths(today(1),1),'The format of ur ExpiryDate field'))>=$(=Date(today(),'The format of ur ExpiryDate field'))"}>}distinct Items)


otherwise it will take all the ExpiryDates even those < today, so it will no longer be on (next 30 days)

sunny_talwar

I think youssefbelloum‌ got it right... this is giving 8

Count({<ExpiryDate={">=$(=Date(today(),'MM/DD/YYYY'))<=$(=date(addMonths(today(1),1),'MM/DD/YYYY'))"}>} ItemCode)

Shahzad_Ahsan
Creator III
Creator III
Author

Thanks to all for the support

OmarBenSalem

Count({<ExpiryDate={"<=$(=date(addMonths(today(1),1),'MM/DD/YYYY'))>=$(=date(today(1),'MM/DD/YYYY'))"}>} ItemCode)


Capture.PNG