Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
uayan
Frequent Visitor

Combine rows into 1 row

Hello all, 

I have a table like this

ABCD
FAILNULLNULLNULL
NULLPASSNULLNULL
NULLNULLFAILNULL
NULLNULLNULLPASS

 

I'd like to convert it to the following (1 row)

ABCD
FAILPASSFAILPASS

 

There are other columns as well but they have already same values.

Thanks a lot.

 

Edit: Actually I had pivotted the table. My table was like that. I want it to convert to the above.

Column1Column2 
AFAIL
BPASS
CFAIL
DPASS
1 ACCEPTED SOLUTION
raju_17
Regular Visitor

After pivot try transpose and make  1st row as header 
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcnP09FHSUfIL9UGnYnWiYfwAx+Bg3LJQCtkkTFlkk2JjAQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [A = _t, B = _t, C = _t, D = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"A", type text}, {"B", type text}, {"C", type text}, {"D", type text}}),
#"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type", {}, "Attribute", "Value"),
#"Filtered Rows" = Table.SelectRows(#"Unpivoted Columns", each ([Value] <> "NULL")),
#"Transposed Table" = Table.Transpose(#"Filtered Rows"),
#"Promoted Headers" = Table.PromoteHeaders(#"Transposed Table", [PromoteAllScalars=true]),
#"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"A", type text}, {"B", type text}, {"C", type text}, {"D", type text}})
in
#"Changed Type1"

View solution in original post

1 REPLY 1
raju_17
Regular Visitor

After pivot try transpose and make  1st row as header 
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcnP09FHSUfIL9UGnYnWiYfwAx+Bg3LJQCtkkTFlkk2JjAQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [A = _t, B = _t, C = _t, D = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"A", type text}, {"B", type text}, {"C", type text}, {"D", type text}}),
#"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type", {}, "Attribute", "Value"),
#"Filtered Rows" = Table.SelectRows(#"Unpivoted Columns", each ([Value] <> "NULL")),
#"Transposed Table" = Table.Transpose(#"Filtered Rows"),
#"Promoted Headers" = Table.PromoteHeaders(#"Transposed Table", [PromoteAllScalars=true]),
#"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"A", type text}, {"B", type text}, {"C", type text}, {"D", type text}})
in
#"Changed Type1"

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors