Filter date <= today in number card

Hello guys,
I am struggling with the dashboard number card. I am building dashboard for our servicedesk. Each task has a start datetime and after this, the technician should change the state to working. The rate card should show the servicedesk which tasks should have been started, but are not in order to notify the technician to change the state.

What I am trying to show is list of all tasks, which have start time in the past and are not in the correct (working or completed) state. I can filter for “start time” in the timespan (last month, this quarter etc…), I can filter for absolute datetime (<= 29.8.2022 12:00), but from some reason I cannot filter “start date” <= now. Did anyone solved this issue within standard filter?

Thank you in advance.

1 Like

did you solve the issue? I have the same problem.

1 Like

We made a workaround where we created custom field which contains number of days from the start time and filter based on this number.

As a workaround it works, but it is suboptimal and if anyone can come up with a better solution, I am all ears.

1 Like

I’m bumping this thread too. A today() filter could be widely used.

I’ve created a server script which updates the filter in the number card.

docNC = frappe.get_doc("Number Card", "Purchase Orders RequiredBy Today")
dctFilters = json.loads(docNC.filters_json)
#dctFilters[2][3] = '2025-05-29'
today = frappe.utils.now_datetime().date()
formatted_today = frappe.utils.formatdate(today, "yyyy-mm-dd")
dctFilters[2][3] = formatted_today
docNC.filters_json = json.dumps(dctFilters)
docNC.save()
1 Like

How to create the server script for number card? @TurkerTunali

Search for “Server Script” in the search bar. Then create a new server script with cron type. It must run at around 00:05.

i want to get current logged in user based data . How to achieve here that count?