Hi @rit372002,
With your sample pbix file I couldn’t work as it has connection to database. But I have created sample with your given example and below is the power query which does give the same output.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUXIEYkMDA6VYHQjfCYiNkPjOaHwXJL4Rmn4jqHpjKN8YTd4Yaj4y3xXGjwUA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Customer = _t, Product = _t, CY = _t]),
#"Pivoted Column" = Table.Pivot(Source, List.Distinct(Source[Product]), "Product", "CY"),
#"Replaced Value" = Table.ReplaceValue(#"Pivoted Column",null,"Y",Replacer.ReplaceValue,{"A", "B", "C", "D", "E"}),
#"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Replaced Value", {"Customer"}, "Attribute", "Value"),
#"Added Custom" = Table.AddColumn(#"Unpivoted Other Columns", "Actual", each if [Value] = "Y" then [Value] else "N", type text),
#"Replaced Value1" = Table.ReplaceValue(#"Added Custom","Y",null,Replacer.ReplaceValue,{"Value"}),
#"Pivoted Column1" = Table.Pivot(#"Replaced Value1", List.Distinct(#"Replaced Value1"[Attribute]), "Attribute", "Actual"),
#"Filtered Rows" = Table.SelectRows(#"Pivoted Column1", each ([Value] = null)),
#"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Value"}),
Custom1 = Table.NestedJoin(Source, {"Customer"}, #"Removed Columns", {"Customer"}, "Sample", JoinKind.LeftOuter),
#"Expanded Sample" = Table.ExpandTableColumn(Custom1, "Sample", {"A", "B", "C", "D", "E"}, {"Prospect for A", "Prospect for B", "Prospect for C", "Prospect for D", "Prospect for E"}),
#"Replaced Value2" = Table.ReplaceValue(#"Expanded Sample",null,"N",Replacer.ReplaceValue,{"Prospect for A", "Prospect for B", "Prospect for C", "Prospect for D", "Prospect for E"})
in
#"Replaced Value2"
Below screen shot for your reference.
Thanks
Mukesh