You should be able to achieve this by calculating the median in the PRE_AGG or PRE_FILTER calculation level and then applying a simple AVG() on top of that, as follows:
hi @darcoli , i realised that the answer is incorrect for such nested aggregation.
Avg is applied on all the rows of the original table, rather than the shorter aggregated table.
In the example above, all the stores will have the same P50 sales for the same city. The final average sales of the P50 by state, will be skewed by cities with many stores.
I realised that Quicksight is unable to give accurate answer for nested aggregations. It will require that the output table from the first aggregation be saved as a table first, before applying the second aggregation.