0

Question

I need help identifying a particular year in a multi-year database.

4 replies

null
    • daviddilworth
    • 3 yrs ago
    • Reported - view

    Didn't know this was actually working. Sorry. Here is my problem - A campground business. We are taking reservations and have data for 2019-2022. I wanted to find out how much revenue we brought in for 2021, but my result is for all the records (all years). I created a table to give me each month's total, but I'm getting totals for all the years added together. Here is the code:

    let i := (select Reservations where month('Date & Time') = 7);
    let x := sum(i.'Total Fees');
    x

    What do I need to do to get just 2021 or 2019? I've made a bar graph, but the figures are for all years. I learned the code above from YouTube lessons. I'm a real rookie. Reservations is the table. Date & Time is the reservation, and of course 7 is July.. Total Fees is the total revenue for each record. I have the code above in a table for each of the 12 months and the only difference is the number.

    • daviddilworth
    • 3 yrs ago
    • Reported - view

    Didn't know this was actually working. Sorry. Here is my problem - A campground business. We are taking reservations and have data for 2019-2022. I wanted to find out how much revenue we brought in for 2021, but my result is for all the records (all years). I created a table to give me each month's total, but I'm getting totals for all the years added together. Here is the code:

    let i := (select Reservations where month('Date & Time') = 7);
    let x := sum(i.'Total Fees');
    x

    What do I need to do to get just 2021 or 2019? I've made a bar graph, but the figures are for all years. I learned the code above from YouTube lessons. I'm a real rookie. Reservations is the table. Date & Time is the reservation, and of course 7 is July.. Total Fees is the total revenue for each record. I have the code above in a table for each of the 12 months and the only difference is the number.

    • Ninox partner
    • RoSoft_Steven.1
    • 3 yrs ago
    • Reported - view

    Oneliner:

    sum((select Reservations where month('Date & Time') = 7 and year('Date & Time') = 2021).'Total Fees');

    Steven

    • daviddilworth
    • 3 yrs ago
    • Reported - view

    Thank you Steven. This is just what I needed. The things I tried were close, but I just dont have the syntax knowledge I need. This single line makes total sense.