Reporting - how to get multiple data keys in table details? Also calculations for nested queries?

I'm looking through and trying to build a script based on what you have in your post you linked.

Could you update the format from your original post so it's more readable? Also, for the data key "ZZ" you had to create to go above the script, did you do a Basic Query, what did you put in as a query? Thanks