Ad hoc filters not working when multi-options are selected for other template variables

I am trying to apply a less than filter on a field using using ad-hoc filters, a custom data source is used in ad-hoc filters, the filter works fine when a single value is chosen for the other template variables, (say for eg. prod is selected for environment variable)

But when, multi-select option is used, i.e. when I choose multiple values of environment variable, which is taken as another template variable here, say I select the environment values as production and non-production, then the less than ad-hoc filter stops working.

I observed that when multiple options are selected for template variables then the data source chosen gets unselected.

Please help me in finding a resolution for the same.