Question
I need help identifying a particular year in a multi-year database.
4 replies
-
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');
xWhat 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.
-
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');
xWhat 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.
-
Oneliner:
sum((select Reservations where month('Date & Time') = 7 and year('Date & Time') = 2021).'Total Fees');
Steven
-
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.
Content aside
- 3 yrs agoLast active
- 4Replies
- 267Views