34
Views
2
Comments
Filtering data per Day, Weekly, Monthly, Quarterly, Half Yearly, Yearly
Application Type
Reactive

Hi,

In dropdown list of the option of "Day, Weekly, Monthly, Quarterly, Half Yearly, Yearly". I want to filter the data based on selected field. Anyone help me the format of "Weekly, Monthly, Quarterly, Half Yearly, Yearly"


Thanks,

Jeyasri R

Hi,

Based on the selection your filter needs to work,

you can use Adddays().

Weekly- Adddays (date, 7)

For  Monthly, Quarterly, Half Yearly - you can use AddMonths()

For yearly - you can use--AddMonths() /AddYears()

Hi Jeyasari

I have achieved the same case while i was working on the activity log data. 

For Day - user the currDate() function as input in aggreagate

For Weekly - first if you want to get the current week data then you need to find the first date of monday like just get the AddDays(currdate(),-(weekday(currdate())). or if you simply want the last seven days data then use AddDays(currdate(),-7)

For Monthly compare the Month of two dates using Month() function or you can simple get the 1st date of current month by using the NewDate() function like NewDate(Curryear(),CurrMonth(),1)

For the Quarterly just get the last 3 month date as AddDays(currdate(),-90) - based on that if you want to select the quart like from january-march, april-june,july-september,oct-dec, then you need to add some conditions to calculate the value of month

like if the month is divided by 3 then just AddMonth(-2) or if Month is divided by 2 then AddMonth(-1) else just use that month as quart start Month and then add Months according to that

For Half year just get the last 6 month date or 6 months comparisons.

for year you can compare the year to get the current year data or for last 12 months you can use the addyear(-1)


I hope this will help.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.