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

Columns connecting

Hi,
I don't know how to fix my data. I want to have 2 columns, first with ID number, and second with link.

Now it looks like that:

adrian33_0-1694083958359.png


I want to add "Issue number_1" to the "Issue number" and the same with images.

How can I do this to keep issue number together with image assigned to this?

1 ACCEPTED SOLUTION

This is how you can get it all into one column.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUcooKSkottLXLy8v10tMStZLzs8FihrhkInViVYyxqnLBI8uU5y6zHDpigUA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [IssueNumber = _t, Image = _t, IssueNumber_1 = _t, Image_1 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"IssueNumber", Int64.Type}, {"Image", type text}, {"IssueNumber_1", Int64.Type}, {"Image_1", type text}}),
    TableToColumns = Table.ToColumns( #"Changed Type" ),
    IssueNumbers = List.Combine ( { TableToColumns{0}, TableToColumns{2} } ),
    Images = List.Combine ( { TableToColumns{1}, TableToColumns{3} } ),
    ListColumns = { IssueNumbers, Images },
    TableFromColumns = Table.FromColumns ( ListColumns ),
    #"Sorted Rows" = Table.Sort(TableFromColumns,{{"Column1", Order.Ascending}}),
    #"Renamed Columns" = Table.RenameColumns(#"Sorted Rows",{{"Column1", "IssueNumber"}, {"Column2", "Image"}}),
    #"Added Custom" = Table.AddColumn(#"Renamed Columns", "Custom", each "ImageNumber " & Number.ToText ( [IssueNumber] ) & " " & [Image], type text)
in
    #"Added Custom"

jennratten_0-1694091148758.png

 

View solution in original post

5 REPLIES 5
jennratten
Super User
Super User

Hello - are you trying to accomplish something like the image below?  If so, this is how you can do it.  If not, please provide an example of the expected result.

jennratten_0-1694089339291.png

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUcooKSkottLXLy8v10tMStZLzs8FihrhkInViVYyxqnLBI8uU5y6zHDpigUA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [IssueNumber = _t, Image = _t, IssueNumber_1 = _t, Image_1 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"IssueNumber", Int64.Type}, {"Image", type text}, {"IssueNumber_1", Int64.Type}, {"Image_1", type text}}),
    TableToColumns = Table.ToColumns( #"Changed Type" ),
    IssueNumbers = List.Combine ( { TableToColumns{0}, TableToColumns{2} } ),
    Images = List.Combine ( { TableToColumns{1}, TableToColumns{3} } ),
    ListColumns = { IssueNumbers, Images },
    TableFromColumns = Table.FromColumns ( ListColumns ),
    #"Sorted Rows" = Table.Sort(TableFromColumns,{{"Column1", Order.Ascending}}),
    #"Renamed Columns" = Table.RenameColumns(#"Sorted Rows",{{"Column1", "IssueNumber"}, {"Column2", "Image"}})
in
    #"Renamed Columns"

yes, something like that 🙂

This is how you can get it all into one column.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUcooKSkottLXLy8v10tMStZLzs8FihrhkInViVYyxqnLBI8uU5y6zHDpigUA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [IssueNumber = _t, Image = _t, IssueNumber_1 = _t, Image_1 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"IssueNumber", Int64.Type}, {"Image", type text}, {"IssueNumber_1", Int64.Type}, {"Image_1", type text}}),
    TableToColumns = Table.ToColumns( #"Changed Type" ),
    IssueNumbers = List.Combine ( { TableToColumns{0}, TableToColumns{2} } ),
    Images = List.Combine ( { TableToColumns{1}, TableToColumns{3} } ),
    ListColumns = { IssueNumbers, Images },
    TableFromColumns = Table.FromColumns ( ListColumns ),
    #"Sorted Rows" = Table.Sort(TableFromColumns,{{"Column1", Order.Ascending}}),
    #"Renamed Columns" = Table.RenameColumns(#"Sorted Rows",{{"Column1", "IssueNumber"}, {"Column2", "Image"}}),
    #"Added Custom" = Table.AddColumn(#"Renamed Columns", "Custom", each "ImageNumber " & Number.ToText ( [IssueNumber] ) & " " & [Image], type text)
in
    #"Added Custom"

jennratten_0-1694091148758.png

 

mussaenda
Super User
Super User

Hi @adrian33 ,

 

add means you need the sum per row? like issue + issue 1?

 

No, I mean that I want to have issue 1 in the same column, but as a seperate value.

Something like:
issue x

issue y
issue_1 x
issue z
issue_1 y

Helpful resources

Announcements
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.

Top Solution Authors
Top Kudoed Authors