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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
brochelle
New Member

How to Move data ID from above the data to next to each line

The way in which we get our data is dirty and requires lots of cleaning in order for us to use it. Most of the time the fix is just time consuming, but this particular issue is a little more complex. The data is given to us with multiple users ID, then the data below for that user; then the next user, their data, and so on. 

 

Example:

c4f964b7dc25866e2c60ec6c08f5142e

 

For me to properly ingest the data and put it into usable tables, I am currently inserting a row on the far left and manually copying and pasting the USER_ID and pasting it next to each row.

 

Example:

e3975765e824ce81c4c98b6b690ce0db

 

Is there an easier way to automate this in Power BI? 

1 ACCEPTED SOLUTION
BA_Pete
Super User
Super User

Hi @brochelle ,

 

You should be able to do something like this:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("TcqxDoAgDATQf+lMQml7UJ11cNU4EeL//4WgC8kNl7tXK93Xfj7HtlKgVJDdehlpoZIskVMUFhmvq7gi9aqFxwDAi31SeZIZhgz9pc+yvQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [date = _t, transID = _t, exNumber1 = _t, locationID = _t]),
    chgTypes = Table.TransformColumnTypes(Source,{{"date", type text}, {"transID", Int64.Type}, {"exNumber1", Int64.Type}, {"locationID", Int64.Type}}),
    addUserIDColumn = Table.AddColumn(chgTypes, "userID", each if [locationID] = null then [transID] else null),
    fillDownUserIDColumn = Table.FillDown(addUserIDColumn,{"userID"}),
    filterOutNullLocationID = Table.SelectRows(fillDownUserIDColumn, each ([locationID] <> null))
in
    filterOutNullLocationID

 

This gives me the following output:

BA_Pete_0-1645635179446.png

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

1 REPLY 1
BA_Pete
Super User
Super User

Hi @brochelle ,

 

You should be able to do something like this:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("TcqxDoAgDATQf+lMQml7UJ11cNU4EeL//4WgC8kNl7tXK93Xfj7HtlKgVJDdehlpoZIskVMUFhmvq7gi9aqFxwDAi31SeZIZhgz9pc+yvQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [date = _t, transID = _t, exNumber1 = _t, locationID = _t]),
    chgTypes = Table.TransformColumnTypes(Source,{{"date", type text}, {"transID", Int64.Type}, {"exNumber1", Int64.Type}, {"locationID", Int64.Type}}),
    addUserIDColumn = Table.AddColumn(chgTypes, "userID", each if [locationID] = null then [transID] else null),
    fillDownUserIDColumn = Table.FillDown(addUserIDColumn,{"userID"}),
    filterOutNullLocationID = Table.SelectRows(fillDownUserIDColumn, each ([locationID] <> null))
in
    filterOutNullLocationID

 

This gives me the following output:

BA_Pete_0-1645635179446.png

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.