Тёмный

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

Access Analytic
Подписаться 89 тыс.
Просмотров 34 тыс.
50% 1

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

Хобби

Опубликовано:

 

1 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 91   
@mandypaulissen
@mandypaulissen 7 месяцев назад
It's insanely nerdy, but more importantly it's insanely brilliant!!!!!! It save a lot of precious life time!!
@AccessAnalytic
@AccessAnalytic 7 месяцев назад
Glad to be of nerdy help 😄
@ChagoiSteve
@ChagoiSteve 5 месяцев назад
Fab just what I needed!
@AccessAnalytic
@AccessAnalytic 5 месяцев назад
Great to know !
@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 👏🏼
@nadiadeshaies1715
@nadiadeshaies1715 Год назад
Wow! You are a gem!!!
@AccessAnalytic
@AccessAnalytic Год назад
Thanks Nadia ☺️
@iliesboukhatem7803
@iliesboukhatem7803 Год назад
Thank you so much, very usefull and well explained :)
@AccessAnalytic
@AccessAnalytic Год назад
You’re welcome
@mohamedrazaa585
@mohamedrazaa585 2 года назад
WYN, you won our hearts ♥️♥️♥️
@GrainneDuggan_Excel
@GrainneDuggan_Excel 2 года назад
Love it. So many tips packed in a few minutes
@AccessAnalytic
@AccessAnalytic 2 года назад
Cheers Grainne 😀
Год назад
Outstanding! Excellent description of the thinking process to imagine the solution and progress to implementation.
@AccessAnalytic
@AccessAnalytic Год назад
Thank you Andrés
@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
@dandane3819
@dandane3819 2 года назад
This is so so clever!
@AccessAnalytic
@AccessAnalytic 2 года назад
Thanks Dan 😊
@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
@andrewsinha2785
@andrewsinha2785 2 года назад
Love the data wrangling tips! Thanks
@AccessAnalytic
@AccessAnalytic 2 года назад
Great! Thanks for letting me know Andrew
@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.
@joserochefort7778
@joserochefort7778 Год назад
Like always your explanations are very clear !!!
@AccessAnalytic
@AccessAnalytic Год назад
You’re very welcome
@khemkas
@khemkas 2 года назад
Incredibly useful. Thank you very much!
@AccessAnalytic
@AccessAnalytic 2 года назад
You’re welcome Shagun
@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
@rick_.
@rick_. 2 года назад
I always learn something from your videos!
@AccessAnalytic
@AccessAnalytic 2 года назад
Glad they help Rick
@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
@kebincui
@kebincui 2 года назад
Fabulous!👍🌹🌹Thanks Wyn for sharing
@AccessAnalytic
@AccessAnalytic 2 года назад
You’re welcome Kebin
@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
@DanielBula1964
@DanielBula1964 2 года назад
This is brilliant! Thank you.
@AccessAnalytic
@AccessAnalytic 2 года назад
Cheers Daniel
@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!! 😊
@FTSociety
@FTSociety Год назад
Amazing solution, thank you!
@AccessAnalytic
@AccessAnalytic Год назад
You’re welcome
@ahmedkammoun9409
@ahmedkammoun9409 2 года назад
Pretty usefull !and i LOVE your english accent !
@AccessAnalytic
@AccessAnalytic 2 года назад
Thanks, it's half Australian Half Welsh 😆
@juanpablodelgadoguirola3758
@juanpablodelgadoguirola3758 2 года назад
Thanks, nicely explained
@AccessAnalytic
@AccessAnalytic 2 года назад
You’re welcome Juan
@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
@luigibru8677
@luigibru8677 10 месяцев назад
Well explained
@AccessAnalytic
@AccessAnalytic 10 месяцев назад
Thank you
@IsaiahHuang
@IsaiahHuang Год назад
very impressive!
@AccessAnalytic
@AccessAnalytic Год назад
Thanks Isaiah
@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
@gvinodnair
@gvinodnair 2 года назад
Brilliant
@AccessAnalytic
@AccessAnalytic 2 года назад
Too kind Vinod
@rrrraaaacccc80
@rrrraaaacccc80 Год назад
💯👍
@AccessAnalytic
@AccessAnalytic Год назад
😀
@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
@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! 😆
@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
@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
@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
@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 Год назад
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
@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
Просмотров 12 тыс.
😍😂❤️ #shorts
00:12
Просмотров 465 тыс.
Combining Excel Tables in a highly flexible way
12:18
Return Previous Row Value in Power query
9:57
Просмотров 24 тыс.
Create Index Column By Group in Power Query
10:26
Просмотров 45 тыс.
Power Query - Avoid "Helper Queries" (+10 Cool Tricks)
18:40
Convert Multiple Column Groups to Rows in Power Query
17:18
LAVOU TÁ NOVA!
0:11
Просмотров 41 млн