Which Query I need to use in Quicksight to get the below desired table

Please let me know which sql query need to pass to get the desired table as shown in the attachment image

You can use a pivot table within Quicksight, put “Stage” in the Rows Field well, “Product” in the Columns field well, and “C02” in the Values field well.

If you are talking about an actual SQL query to transform the data structure, the easiest way would be to do something like this:

select Stage, Co2 as “ProdA-Co2” , b.ProdB-Co2
from table
left join ( select Stage, Co2 as “ProdB-Co2” from table where Product = ‘Prod B’) b
on table.stage = b.stage
where Product = ‘Prod A’

1 Like