The request format is selected at panel level, not per query.
All queries of a panel are sent to the backend inside a single POST to /api/datasources/proxy/<datasource id>/query. As soon as one query of the panel has "Metric Aggregations" enabled, the whole panel is routed to the aggregation endpoint and every query of that panel is placed inside the same "NASAggregations" array.
The aggregation endpoint requires every element of that array to carry a "query" element containing the pipeline of operations (FROM, JOIN_TOPOLOGY, FILTER, JOIN_DATA, GROUP, SUM, ORDER, KEEP and so on).
A query built with the Query Builder while "Metric Aggregations" is disabled is serialized in the standard metric query format, which contains only "querySpecifier", "queryRange" and "clampSize", and has no "query" element. The backend therefore rejects that element with "Mandatory 'query' field missing".
A second confirmation that the two queries are built for two different API contracts is the time unit used in "queryRange" within the same request: the aggregation query uses milliseconds (for example endTime 1786139999000, rangeSize 691200000, frequency 3600000) while the non-aggregation query uses seconds (for example endTime 1786139999, rangeSize 691200, frequency 3600).
The panel displays "No data" even though the aggregation query returned results, because the failed query invalidates the data set consumed by the panel transformations.
In summary, a Raw Query or Query Builder query with "Metric Aggregations" enabled and a Query Builder query with "Metric Aggregations" disabled cannot be combined in the same panel.