0

Showing all gifts for the last 12 months

I am trying to create a Kanban or card view that displays all donations given in the last 12 months, sorted by month. The sorting isn't difficult, but I've always struggled with the code for displaying time periods in Ninox. I think the formula would look something like this (but definitely not EXACTLY like this):

yearmonth('Date Given') :=< today - 365

3 replies

null
    • Cegep de jonquiere
    • James_Deraps.1
    • 5 yrs ago
    • Reported - view

    youcan use the filter  from and to for a date

    • Ivan_Savochenko
    • 5 yrs ago
    • Reported - view

    I'm not sure if this will help. You can get a list of twelve last months with this code:

    let d := today();
    for m from 0 to 12 do
    yearmonth(date(year(d) - 1, month(d) + m, 1))
    end

    Today is 2019/07/17 so the code gives next list:

    2018/07
    2018/08
    2018/09
    2018/10
    2018/11
    2018/12
    2019/01
    2019/02
    2019/03
    2019/04
    2019/05
    2019/06

    • Mconneen
    • 5 yrs ago
    • Reported - view

    Use someting like the following for the base of the view  assuming you are using a year month boundary.   Assume you have a table named Gifts.. and on that table you have your column 'Date Given'... You can use the following select as the base of the view. 

    let t:= today();
    let endDate := yearmonth(t);
    let startDate := yearmonth(date(year(t)-1, month(t), day(t)));
    select Gifts [yearmonth('Date Given') >= startDate and yearmonth('Date Given') <= endDate]

Content aside

  • 5 yrs agoLast active
  • 3Replies
  • 1307Views