Since you are using CASE statements and subqueries in your views, I think there's a chance that your query is not getting delegated to your data source, therefore the performance is slow.
You can verify this if you check the** execution trace** of the view when you run it. You can refer to this [article](https://community.denodo.com/kb/en/view/document/Getting%20the%20SQL%20query%20delegated%20by%20a%20derived%20view) as reference, which shows an example to navigate on the execution trace to identify query delegation to the source. You can also check this documentation for more information on the different [Data Source Configuration Properties](https://community.denodo.com/docs/html/browse/8.0/en/vdp/administration/creating_data_sources_and_base_views/data_source_configuration_properties/data_source_configuration_properties), specially on **delegating scalar functions**. I find this Knowledge Base article regarding [Best Practices in detecting query performance bottlenecks](https://community.denodo.com/kb/en/view/document/Best%20Practices%20to%20Maximize%20Performance%20IV:%20Detecting%20Bottlenecks%20in%20a%20Query?category=Best%20Practices) a good reference to start when debugging.
As for the error message in your local environment, “*SQL Server did not return a response. The connection has been closed*” I suggest to double check the following in your local environment:
* Are you using the same driver as in Dev/Test environment?
* Are the data source connection details correct?
* Can you establish a connection directly to the data source with SQL Management Studio?
Hope this helps.