Dynamic filter data by timeframes doesn't work

I’m looking to display expenses based on these timeframes: Today, This Month, This Year (based on this tutorial https://www.youtube.com/watch?v=pApLeMYHFzE).

Here are my expenses data table and Work data table

Expenses data table


Work data table


Screen Shot 2024-08-11 at 1.53.33 PM

I already created a rel_expense column that relates the input This Month, This Year, etc. to the timeFrame array storing month, year, week, etc. of the expense date.

On my layout, when I select “This Month”, the output returned is correct

But it is blank/not correct when I select “This Year” or “This Week”,


Any idea what issue I might be encountering? Thanks!

Hola Thuy!

Just a curiosity:

Why does your “Timeframe value” column have a static value (text) instead of a number?

Something strange is doing your choice component (I think).

Bye bye

I think if you have User Profiles setup, you can have:

  • A user-specific column to store whether the user wants to view “This Week”, “This Month” or “This Year”.
  • Craft computed columns to calculate each corresponding time frame’s numbers.
  • Show/hide components based on what the user wants to view.
1 Like