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
tinye
Regular Visitor

how to make a new column like this

Table:

L-A

B

C

L-B

C

D

E

 

My expectation:

L-AL-A

L-AB

L-AC

L-BL-B

L-BC

L-BD

L-BE

1 ACCEPTED SOLUTION
v-yalanwu-msft
Community Support
Community Support

Hi, @tinye ;

You could add conditional column in power query.

1. add conditional column.

if [Column1] = "Men"  or [Column1] = "Women"   then [Column1] else null

vyalanwumsft_0-1666934807509.png

2.Then fill down it.

vyalanwumsft_1-1666934870046.png

3.Then filter the rows(not "Men"  an "Women")

vyalanwumsft_2-1666935350078.png

The final show:

vyalanwumsft_3-1666935366638.png

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8k3NU4rViVZyBJNOYDI8Pxcq6gwmXcCkK5h0A5PuSrGxAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}}),
    #"Added Conditional Column" = Table.AddColumn(#"Changed Type", "Custom", each if [Column1] = "Men"  or [Column1] = "Women"   then [Column1] else null),
    #"Filled Down" = Table.FillDown(#"Added Conditional Column",{"Custom"}),
    #"Filtered Rows" = Table.SelectRows(#"Filled Down", each [Column1] <> "Men" and [Column1] <> "Women")
in
    #"Filtered Rows"


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

View solution in original post

4 REPLIES 4
v-yalanwu-msft
Community Support
Community Support

Hi, @tinye ;

You could add conditional column in power query.

1. add conditional column.

if [Column1] = "Men"  or [Column1] = "Women"   then [Column1] else null

vyalanwumsft_0-1666934807509.png

2.Then fill down it.

vyalanwumsft_1-1666934870046.png

3.Then filter the rows(not "Men"  an "Women")

vyalanwumsft_2-1666935350078.png

The final show:

vyalanwumsft_3-1666935366638.png

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8k3NU4rViVZyBJNOYDI8Pxcq6gwmXcCkK5h0A5PuSrGxAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}}),
    #"Added Conditional Column" = Table.AddColumn(#"Changed Type", "Custom", each if [Column1] = "Men"  or [Column1] = "Women"   then [Column1] else null),
    #"Filled Down" = Table.FillDown(#"Added Conditional Column",{"Custom"}),
    #"Filtered Rows" = Table.SelectRows(#"Filled Down", each [Column1] <> "Men" and [Column1] <> "Women")
in
    #"Filtered Rows"


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

Great! Works! Thanks so much!

tinye
Regular Visitor

Hi, 

Okay, I can have a more clear example.

I have a table which I can't edit it, but it has some categorize like:

Column 1

Men

A

B

Women

C

D

E

F

 

I want to split two columns like:

Column1    Column2

A                 Men

B                 Men

C                 Women

D                 Women

E                  Women

F                  Women

Fowmy
Super User
Super User

@tinye 

Van you explain the logic?

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.