Can I transform rows into columns or vice versa with the help of pivot transformation

Can I transform rows into columns or vice versa with the help of pivot transformations or with the help of any other visualization.

Attached image is my requirement:
Untitled

You can do that using the data transforms from ML: Transforming data | Elasticsearch Guide [8.1] | Elastic

I have tried that option, but its not working.
can you please share some steps, how can it be done.

please share if any solution.