Grafana Promql legend renaming

Hi,

Need help with legend display on panel .

I have metrics in below format -
kafka_volume_size{topic=topic1} 20000
kafka_volume_size{topic=topic2} 30000
kafka_volume_size{topic=topic3} 30000

I have another metrics topic and feed mapping
topic_mapping{topic=topic1, feed=feedA} 1
topic_mapping{topic=topic2, feed=feedB} 1
topic_mapping{topic=topic3, feed=feedC} 1

Now, I am creating panel in Grafana with prometheus database with below query:
kafka_volume_size{topic=~"$topic"} # This will include all the 3 or more topics as given above.

But in Legend on graph panel with feed details as given in topic_mappings.

Please guide, how I can combine two metrics…

Thanks
Sunil