cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
anshpalash
Helper II
Helper II

Data Cleaning

Hi,

 

I have a dataset in the form.

1nullStart: 7:20nullnullDuration: 3nullEnd:10
1nullnullnullnullnullnullnull
1nullnullnullnullnullnullnull
1nullnullnullnullnullnullnull
2Start: 6:30nullnullDuration:5nullnullEnd:11
2nullnullnullnullnullnullnull
2nullnullnullnullnullnullnull
2nullnullnullnullnullnullnull
2nullnullnullnullnullnullnull
3nullnullnullnullnullnullnull
3nullnullnullnullnullnullnull
3Start: 9:15nullnullDuration:4nullEnd:1null
3nullnullnullnullnullnullnull
3nullnullnullnullnullnullnull
3nullnullnullnullnullnullnull

 

I want to convert it to format:

 

1Start: 7:20Duration: 3End:10
2Start: 6:30Duration:5End:11
3Start: 9:15Duration:4End:1

 

I would really appreciate if someone could advise how to achieve this since there is so much irregularity in the position of the start, duration, and end across different files. Thank you!

1 ACCEPTED SOLUTION
Syndicate_Admin
Administrator
Administrator

You can this step to your query.

= Table.FromRows( List.RemoveNulls( List.Transform(Table.ToRows(PriorStepName), each let l=List.RemoveNulls(_) in if List.Count(l)>1 then l else null) ), {"ID","Start","Duration","End"} )

Result

Jakinta_0-1632940649523.png

 

View solution in original post

4 REPLIES 4
Jakinta
Super User
Super User

...or slightly cleaner...

= Table.FromRows( List.Select(List.Transform(Table.ToRows( PriorStepName ), List.RemoveNulls), each List.Count(_)>1 ), {"ID","Start","Duration","End"} )
Syndicate_Admin
Administrator
Administrator

You can this step to your query.

= Table.FromRows( List.RemoveNulls( List.Transform(Table.ToRows(PriorStepName), each let l=List.RemoveNulls(_) in if List.Count(l)>1 then l else null) ), {"ID","Start","Duration","End"} )

Result

Jakinta_0-1632940649523.png

 

View solution in original post

Thank you so much!

Jakinta
Super User
Super User

You can add this step to your query.

 

= Table.FromRows( List.RemoveNulls( List.Transform(Table.ToRows(PriorStepName), each let l=List.RemoveNulls(_) in if List.Count(l)>1 then l else null) ), {"ID","Start","Duration","End"} )

 

Result

Jakinta_0-1632940649523.png

 

Helpful resources

Announcements
Power BI December 2021 Update_carousel 768x460.jpg

Check it Out!

Click here to read more about the December 2021 Updates!

User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Jan 2022 Dev Camp 768x460 copy.png

Power BI Dev Camp- January 27th, 2022

Mark your calendars and join us for our next Power BI Dev Camp!

Top Solution Authors