Data Deployment Error: InvalidBatch : Failed to process query: QUERY_TOO_COMPLICATED: Query is either selecting too many fields or the filter conditions are too complicated

When doing a data deployment, Salesforce may return the following error:

“InvalidBatch : Failed to process query: QUERY_TOO_COMPLICATED: Query is either selecting too many fields or the filter conditions are too complicated”

As explained in Salesforce’s article, formula fields get expanded when the actual SFDC query runs.
 
This error appears when the expansion exceeds the maximum character limit for query filters.

To fix this issue, navigate to the Main Object Filter tab of the data template that contains the error, remove the filters based on formula fields and deploy again.

How did we do?