cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
Anonymous
Not applicable

Remove nulls and move values up to one line

Hi everyone!
Yesterday a kind user helped me to transform every 4 rows into columns. 
But now I have to move up all the info of those columns up - remove nulls and transform the info to a line.

Please see the pic below:Sem título - Power Query Editor.jpg

For example, the first line would be 1234 / xyz / id / may-20

 

How can I do that?
I've tried to filter, but the other columns disappear. 
Also tried to fill up but I couldn't - I'm a newbie user..lol

Any tips? If so, would be great to know where to put the strings, etc... lol 😄

Thanks a lot! (L)

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @Anonymous ,

 

I went back to your initial post and believe that the solution provided by @edugoncalves  is not the best one, you can perform this without adding a column for each one and get a value per row.

 

Do the following:

  • On your original data add a Index Column

MFelix_0-1617972872808.png

  • Add a custom column with the following syntax:

 

if [#" Column2"] = "Group" then [Index] else null

 

Use the name of the first value of your data in the IF part in this case you refer that is group.

MFelix_1-1617972927159.png

  • Do a fill down on the nem column:

MFelix_2-1617973003849.pngMFelix_3-1617973016244.png

  • Remove Index Column
  • Do a Pivot by column two values without aggregating the column 1

MFelix_4-1617973125337.pngMFelix_5-1617973158136.png

Now you can delete the custom column.

 

@edugoncalves sorry for giving an option on top of yours but believe is much easier and effecient.

 

PBIX file attach.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

3 REPLIES 3
edugoncalves
Resolver I
Resolver I

@MFelix
In fact, this solution is much more straight and scalable than what I proposed.
Thanks for sharing, Miguel!

MFelix
Super User
Super User

Hi @Anonymous ,

 

I went back to your initial post and believe that the solution provided by @edugoncalves  is not the best one, you can perform this without adding a column for each one and get a value per row.

 

Do the following:

  • On your original data add a Index Column

MFelix_0-1617972872808.png

  • Add a custom column with the following syntax:

 

if [#" Column2"] = "Group" then [Index] else null

 

Use the name of the first value of your data in the IF part in this case you refer that is group.

MFelix_1-1617972927159.png

  • Do a fill down on the nem column:

MFelix_2-1617973003849.pngMFelix_3-1617973016244.png

  • Remove Index Column
  • Do a Pivot by column two values without aggregating the column 1

MFelix_4-1617973125337.pngMFelix_5-1617973158136.png

Now you can delete the custom column.

 

@edugoncalves sorry for giving an option on top of yours but believe is much easier and effecient.

 

PBIX file attach.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Anonymous
Not applicable

Great solution too, MFelix!
Thanks for that! I've tested too and worked fine!
Thanks a lot!

 

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors