Aggregate on Field Keys (String Type) and loop through all tag value

InfluxDB(Version: 1.8.2) consists of field keys as a string type from the source. I am trying to perform aggregation on these field types. Could you please let me know ways to aggregate these field keys and loop these through all the tag keys in a measurement?