Insert Blank Row for each change in a value using Power Query

  Рет қаралды 34,824

Access Analytic

Access Analytic

Күн бұрын

Power Query in Excel can be used for so many purposes and converting data ready for upload into another system is just one.
In this scenario I show a couple of techniques to insert a row for each change in a group of items.
Did you know a Query can be appended with itself!?
00:00 Intro
00:38 Setting the Scenario
02:14 The Steps
03:56 Appending a query with itself and change a table name to a step name
05:15 Conditional Column
06:48 Alternative approach to adding a conditional column
08:53 Testing with extra data
09:30 Recommended extra elements - renaming and adding comments
Follow me on LinkedIn
/ wynhopkins
Twitter
/ wynhopkins
Access Analytic Training
accessanalytic.com.au/training

Пікірлер: 91
@mandypaulissen
@mandypaulissen 8 ай бұрын
It's insanely nerdy, but more importantly it's insanely brilliant!!!!!! It save a lot of precious life time!!
@AccessAnalytic
@AccessAnalytic 8 ай бұрын
Glad to be of nerdy help 😄
Жыл бұрын
Outstanding! Excellent description of the thinking process to imagine the solution and progress to implementation.
@AccessAnalytic
@AccessAnalytic Жыл бұрын
Thank you Andrés
@ChagoiSteve
@ChagoiSteve 6 ай бұрын
Fab just what I needed!
@AccessAnalytic
@AccessAnalytic 5 ай бұрын
Great to know !
@pascalpelzer6887
@pascalpelzer6887 2 жыл бұрын
Thanks a lot! The extra row and "append query" helped me in making a total row per "Journal" as it were. Very good video's!!
@AccessAnalytic
@AccessAnalytic 2 жыл бұрын
Thanks for letting me know. Glad I could help
@midoriyaone
@midoriyaone Жыл бұрын
Thank you so much! Huge thank you man! I performed this process at work manually and it took me a lot of time to do it, now everything is automated. Health and good luck, thanks again! :) You are a really cool professional
@AccessAnalytic
@AccessAnalytic Жыл бұрын
Fantastic ! Glad to help
@GrainneDuggan_Excel
@GrainneDuggan_Excel 2 жыл бұрын
Love it. So many tips packed in a few minutes
@AccessAnalytic
@AccessAnalytic 2 жыл бұрын
Cheers Grainne 😀
@SustainaBIT
@SustainaBIT 2 жыл бұрын
that's the advanced techniques that we need more of!!!, I consider myself an advanced user of power query and I just learned from you something new. Thanks a ton :)
@AccessAnalytic
@AccessAnalytic 2 жыл бұрын
We’re all learning Azzam, glad to help, thanks for taking the time to let me know it’s useful.
@nadiadeshaies1715
@nadiadeshaies1715 Жыл бұрын
Wow! You are a gem!!!
@AccessAnalytic
@AccessAnalytic Жыл бұрын
Thanks Nadia ☺️
@mohamedrazaa585
@mohamedrazaa585 2 жыл бұрын
WYN, you won our hearts ♥️♥️♥️
@IvanCortinas_ES
@IvanCortinas_ES 2 жыл бұрын
A few years ago I barely played Power Query. Now, among other reasons, by watching your videos, I have become a fan of Power Query. Thank you Wyn!!
@AccessAnalytic
@AccessAnalytic 2 жыл бұрын
Excellent to know Iván 👏🏼
@andrewsinha2785
@andrewsinha2785 2 жыл бұрын
Love the data wrangling tips! Thanks
@AccessAnalytic
@AccessAnalytic 2 жыл бұрын
Great! Thanks for letting me know Andrew
@iliesboukhatem7803
@iliesboukhatem7803 Жыл бұрын
Thank you so much, very usefull and well explained :)
@AccessAnalytic
@AccessAnalytic Жыл бұрын
You’re welcome
@khemkas
@khemkas 2 жыл бұрын
Incredibly useful. Thank you very much!
@AccessAnalytic
@AccessAnalytic 2 жыл бұрын
You’re welcome Shagun
@kebincui
@kebincui 2 жыл бұрын
Fabulous!👍🌹🌹Thanks Wyn for sharing
@AccessAnalytic
@AccessAnalytic 2 жыл бұрын
You’re welcome Kebin
@tracylippiatt3238
@tracylippiatt3238 2 жыл бұрын
I love the way you think Wyn - great idea
@AccessAnalytic
@AccessAnalytic 2 жыл бұрын
Thanks Tracy 😀
@wayneedmondson1065
@wayneedmondson1065 2 жыл бұрын
Hi Wyn. Awesome! Nice to understand two ways to solve it. Thanks for sharing :)) Thumbs up!!
@AccessAnalytic
@AccessAnalytic 2 жыл бұрын
Cheers Wayne. Always more than 1 way to tackle these things
@joserochefort7778
@joserochefort7778 Жыл бұрын
Like always your explanations are very clear !!!
@AccessAnalytic
@AccessAnalytic Жыл бұрын
You’re very welcome
@rick_.
@rick_. 2 жыл бұрын
I always learn something from your videos!
@AccessAnalytic
@AccessAnalytic 2 жыл бұрын
Glad they help Rick
@dandane3819
@dandane3819 2 жыл бұрын
This is so so clever!
@AccessAnalytic
@AccessAnalytic 2 жыл бұрын
Thanks Dan 😊
@X1AbuBadr1X
@X1AbuBadr1X Жыл бұрын
You are amazing , im still a beginner in Power Query , but im learning so much from you
@AccessAnalytic
@AccessAnalytic Жыл бұрын
Glad to help you along your learning journey
@FTSociety
@FTSociety Жыл бұрын
Amazing solution, thank you!
@AccessAnalytic
@AccessAnalytic Жыл бұрын
You’re welcome
@Bhavik_Khatri
@Bhavik_Khatri 2 жыл бұрын
Very nice method. I like your 2nd method.
@AccessAnalytic
@AccessAnalytic 2 жыл бұрын
Thanks, I'll be doing a video on a 3rd method several people submitted
@Bhavik_Khatri
@Bhavik_Khatri 2 жыл бұрын
@@AccessAnalytic Would like to see the third method too.
@AccessAnalytic
@AccessAnalytic 2 жыл бұрын
@@Bhavik_Khatri just published it
@malejandrahorvath
@malejandrahorvath 2 жыл бұрын
This is great! Thank you Wyn!
@AccessAnalytic
@AccessAnalytic 2 жыл бұрын
Thanks Alejandra 😀. Good work on your new video too
@malejandrahorvath
@malejandrahorvath 2 жыл бұрын
@@AccessAnalytic Thank you so much!! 😊
@DanielBula1964
@DanielBula1964 2 жыл бұрын
This is brilliant! Thank you.
@AccessAnalytic
@AccessAnalytic 2 жыл бұрын
Cheers Daniel
@juanpablodelgadoguirola3758
@juanpablodelgadoguirola3758 2 жыл бұрын
Thanks, nicely explained
@AccessAnalytic
@AccessAnalytic 2 жыл бұрын
You’re welcome Juan
@ahmedkammoun9409
@ahmedkammoun9409 2 жыл бұрын
Pretty usefull !and i LOVE your english accent !
@AccessAnalytic
@AccessAnalytic 2 жыл бұрын
Thanks, it's half Australian Half Welsh 😆
@Scientificandresearch
@Scientificandresearch Жыл бұрын
Very useful
@AccessAnalytic
@AccessAnalytic Жыл бұрын
You're welcome
@martyc5674
@martyc5674 2 жыл бұрын
Very good- some useful tricks in there :)
@AccessAnalytic
@AccessAnalytic 2 жыл бұрын
Cheers Martin, thanks for letting me know
@IsaiahHuang
@IsaiahHuang Жыл бұрын
very impressive!
@AccessAnalytic
@AccessAnalytic Жыл бұрын
Thanks Isaiah
@luigibru8677
@luigibru8677 10 ай бұрын
Well explained
@AccessAnalytic
@AccessAnalytic 10 ай бұрын
Thank you
@IsaiahHuang
@IsaiahHuang Жыл бұрын
We can also add an index column in the beginning as the "Journal" column in the video and remove it at the end. In this way, we won't hardcode any header names. Here is the M code. Thanks again for the inspiring video. let Source = Excel.CurrentWorkbook(){[Name="example"]}[Content], #"Added Index" = Table.AddIndexColumn(Source, "Index", 1, 1, Int64.Type), OriginalData = #"Added Index", #"Removed Other Columns" = Table.SelectColumns(OriginalData,{"Index"}), #"Appended Query" = Table.Combine({#"Removed Other Columns", OriginalData}), #"Sorted Rows" = Table.Sort(#"Appended Query",{{"Index", Order.Ascending}}), #"Removed Columns" = Table.RemoveColumns(#"Sorted Rows",{"Index"}), #"Removed Top Rows" = Table.Skip(#"Removed Columns",1) in #"Removed Top Rows"
@AccessAnalytic
@AccessAnalytic Жыл бұрын
Thanks Isaiah, that's a nice solution if we want a blank row after every single entry.
@IsaiahHuang
@IsaiahHuang Жыл бұрын
Yes, I noticed that right after sending out the post and don't know how to withdraw the post 😆. Sorry for my ignorance. 😅 Again, I have seen how to insert blank rows before, but your method is simplest and with least hardcoding. Nice work! Thank you for sharing the idea.
@AccessAnalytic
@AccessAnalytic Жыл бұрын
@@IsaiahHuang - all suggestions are welcome :). Thanks for following the channel
@asjones987
@asjones987 Жыл бұрын
nice this inspired me for one i i was looking at that needed 2 blank rows. For the blank row table i created a custom column with "1,2" called it decimal. Then did a split column by delimiter but split to rows then converted to number and multiplied by .1. I then added a normal index and column. Using math I combined the index column + the decimal column. and got rows like 1.1, 1.2, 2.1, 2.2, 3.1, 3.2 ..... then on my main table I created an index, Appended the new table and sorted. So the main Index was 1 with the blanks being 1.1, 1.2. then next group 2, 2.1, 2.2... then it all sorted nice. was surprised it worked so nicely.
@AccessAnalytic
@AccessAnalytic Жыл бұрын
Good one Alan
@tlee7028
@tlee7028 Жыл бұрын
Thank you for sharing! from your example, how would I remove repeated J1-23? I would only like to keep say... J1-23 and J1-24. thanks !
@AccessAnalytic
@AccessAnalytic Жыл бұрын
Difficult to explain without screen but I'm thinking add an INDEX Column, create a reference step that then picks the Journal column and the index column. Remove duplicates on the Journal column. Merge back with the query prior to the reference step and expand. That probably makes no sense! 😆
@gvinodnair
@gvinodnair 2 жыл бұрын
Brilliant
@AccessAnalytic
@AccessAnalytic 2 жыл бұрын
Too kind Vinod
@9699975917
@9699975917 2 жыл бұрын
Thanks! Could you calculate turn around time where after 3 pm it is consider as next day if it is weekend or Holiday then we have to exclude those days as well.
@AccessAnalytic
@AccessAnalytic 2 жыл бұрын
Yes that sort of thing is possible using Custom columns containing “if” functions
@tonybarker4240
@tonybarker4240 Жыл бұрын
Thanks for this tutorial - can you change it to add the blank row above each change and use the Journal number in the added row (so that it looks like a sub header) do you have a tutorial on that please ?
@AccessAnalytic
@AccessAnalytic Жыл бұрын
There’s probably a way using the opposite sort order to get the row at the top. Then some form of Add Column - Conditional column to get the label
@rrrraaaacccc80
@rrrraaaacccc80 Жыл бұрын
💯👍
@AccessAnalytic
@AccessAnalytic Жыл бұрын
😀
@nickbrown341
@nickbrown341 2 жыл бұрын
How would you add multiple rows for each change in value? For example, I have a table of departments and project codes and I wanted to add a few new project codes for each department.
@AccessAnalytic
@AccessAnalytic 2 жыл бұрын
Not sure I understand the use case, but to add 2 rows where I added one you could in theory do an extra combine of the BlankRowHelper step
@MrJohnreggie
@MrJohnreggie Жыл бұрын
Thank you so much for the explaining ,,,,, Ok...I got it ....But now I would like to put 4 row between ,, how I can do that :
@AccessAnalytic
@AccessAnalytic Жыл бұрын
I’m not clear on what you mean sorry
@MrJohnreggie
@MrJohnreggie Жыл бұрын
great....and how can I add 4 row instead one between repited dates
@AccessAnalytic
@AccessAnalytic Жыл бұрын
Add a custom column to the Helper rows part containing ={1..4} then expand to rows
@adrianchuzzz
@adrianchuzzz 2 жыл бұрын
Great video. I followed every step and I was able to get my query with the blank rows between sets of data. However, when I loaded the query to my sheet, it shows the blank rows at the bottom. Do you have any idea what can the problem be?
@AccessAnalytic
@AccessAnalytic 2 жыл бұрын
Is there a sort on one of your table columns? Click On the excel table, go to data and click the clear filters icon then refresh
@adrianchuzzz
@adrianchuzzz 2 жыл бұрын
@@AccessAnalytic Thanks for your reply. There isn't any sorting, I even tried removing the filters.
@AccessAnalytic
@AccessAnalytic 2 жыл бұрын
Very odd - add an index column to your last power query step and then load that to see what happens
@michaelthwaite3282
@michaelthwaite3282 2 жыл бұрын
Insert Blank Row for each change in a value. How about . . . Alt+F11 (opens VBA) - Insert Module - paste the following: Sub InsertRowsAtValueChange() 'Update 20140716 Dim Rng As Range Dim WorkRng As Range On Error Resume Next xTitleId = "KutoolsforExcel" Set WorkRng = Application.Selection Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8) Application.ScreenUpdating = False For i = WorkRng.Rows.Count To 2 Step -1 If WorkRng.Cells(i, 1).Value WorkRng.Cells(i - 1, 1).Value Then WorkRng.Cells(i, 1).EntireRow.Insert End If Next Application.ScreenUpdating = True End Sub Run macro highlighting the column where the data changes (eg Date or Time)
@AccessAnalytic
@AccessAnalytic 2 жыл бұрын
Yep a huge amount of Power Query can be replicated in VBA. Cheers Michael.
Power Query Formula Help
4:51
Access Analytic
Рет қаралды 12 М.
Insert blank row after name change in Excel - Dynamic Formula
5:35
Slow motion boy #shorts by Tsuriki Show
00:14
Tsuriki Show
Рет қаралды 6 МЛН
Clown takes blame for missing candy 🍬🤣 #shorts
00:49
Yoeslan
Рет қаралды 34 МЛН
Red❤️+Green💚=
00:38
ISSEI / いっせい
Рет қаралды 76 МЛН
3 Essential Excel skills for the data analyst
18:02
Access Analytic
Рет қаралды 1,5 МЛН
Return Previous Row Value in Power query
9:57
BI Gorilla
Рет қаралды 25 М.
Power Query - Avoid "Helper Queries" (+10 Cool Tricks)
18:40
Excel PowerQuery - Keeping Manual Entries
11:58
PowerConcepts
Рет қаралды 8 М.
Inside Power Query reference queries for Power BI and Excel
18:57
Guy in a Cube
Рет қаралды 34 М.
This is how I ACTUALLY analyze data using Excel
24:05
Mo Chen
Рет қаралды 70 М.
Unstack a Million Uneven Rows to Columns in Power Query
10:50
Amazing
0:37
GT Tradition
Рет қаралды 25 МЛН
Застрял в КУБЕ😱
0:21
Koko Nicole
Рет қаралды 2,3 МЛН
Some muslims mistakes #muslimfemale #hijab
0:11
Asel Mustafaeva
Рет қаралды 10 МЛН
Beautiful gymnastics 😍☺️
0:15
Lexa_Merin
Рет қаралды 13 МЛН