Kibana formula for metric

Hello all,
I'm new to Kibana and trying to make a table visualization that the metric would be:
The max subscribers for each zip code and sum them for each AOI, the calculation in tableau looks like: {SUM({INCLUDE [AOI],[zip_code]: MAX([Unique Subscribers])})}

Anyone can kindly help how can I make that happen? is there a way to write it in the formula?

Thanks

Or I may add a scripted field to the data view? what should the query look like in this case