How can I add a filter to a query/report without making it mandatory? For example, if I add a filter, I want it to be optional, not mandatory.
Are you asking for custom report? if yes you can just remove "reqd": 1 from the js file of that report.
Example:
{
"fieldname":"customer",
"label": __("Customer"),
"fieldtype": "Link",
"options": "Customer",
// "reqd": 1, Remove this key and value.
}