Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
hi,
i have a field which contains month names and i want total no. of days from the selection of month.
for example if someone select December then it should give 31 days.
how to achieve this.
Regards ,
Himanshi Dubey
May be Something like this:
Floor(MonthEnd(Today())) - Floor(MonthStart(Today())) + 1
or based on selection:
Floor(MonthEnd(Max(DateField))) - Floor(MonthStart(Max(DateField))) + 1
Hi Swuehi, your solution works for me, but may I ask you how to identify if February has 28 or 29 Days?
For example, Feb-2023 has 28, and Feb-2024 has 29. Is there any way?
Thank you in advance
May be Something like this:
Floor(MonthEnd(Today())) - Floor(MonthStart(Today())) + 1
or based on selection:
Floor(MonthEnd(Max(DateField))) - Floor(MonthStart(Max(DateField))) + 1
Do you have trxn date?
If yes, try with this expression:
=count(distinct Day(TrxnDate))
=Day(Monthend(Date#('December','MMMM')))
resp.
Day(Monthend(Date#(YourMonthField,'MMMM')))
You may need to take care of february in leap years, so maybe add year to the date string.
Hi Himanshi,
PFA Sample application
-Regards,
Vishal Waghole
If you don't care about Feburary sometimes having 29 days, your simplest option may be to create a static inline table with NoOfDays and connect it to your calendar. Using a field makes your expressions simpler, and IMHO it may even make performance a tiny little bit better. Not sure of the last one, though.
DaysInMonth:
LOAD * INLINE [
MonthName, Days
January, 31
February, 28
March, 31
April, 30
May, 31
June, 30
July, 31
August, 31
September, 30
October, 31
November, 30
December, 31
];
You can also add a field DaysInMonth to your calendar, an fill it using the Day(MonthEnd(CalDate)) formula. That would take care of the leap years.
Best,
Peter
[Edit]: reread your OP, month names it was...
hi,
thanks to all of you for quick response.
Regards,
Himanshi
Day(MonthEnd(YourDateFieldName))
Hi Swuehi, your solution works for me, but may I ask you how to identify if February has 28 or 29 Days?
For example, Feb-2023 has 28, and Feb-2024 has 29. Is there any way?
Thank you in advance