Create Index Column By Group in Power Query

  Рет қаралды 53,003

BI Gorilla

BI Gorilla

Күн бұрын

Пікірлер: 65
@BIGorilla
@BIGorilla Жыл бұрын
To learn more about the syntax of Table.AddIndexColumn function, make sure to check out: powerquery.how/table-addindexcolumn/
@ericrobbins6953
@ericrobbins6953 Жыл бұрын
OMG, THIS, THIS, THIS...I needed THIS! Thank you. Subscribed!
@ДенисДементьев-т3о
@ДенисДементьев-т3о Жыл бұрын
Dear BI Gorilla, your way of explanation is extremely clear and understandable. Thank you very much for video.
@viniscera-97
@viniscera-97 10 ай бұрын
Thank you from Brazil! This solution solved my problem
@FRANKWHITE1996
@FRANKWHITE1996 Жыл бұрын
To honor this film I've called one step of my query "bi gorilla" ❤
@fajnefajne4339
@fajnefajne4339 5 ай бұрын
I love this comprehensive explanation. Thank you. I feel like in the supermarket. I have a choice and I can pick up the solution I like 😊
@vaigundhansridhar6745
@vaigundhansridhar6745 2 ай бұрын
this was amazing! Just what was needed while solving a tough use case. Thank you :)
@alexrosen8762
@alexrosen8762 2 жыл бұрын
Very useful tutorial. Many use cases for example to create unique index numbers for rows in different segments.
@BIGorilla
@BIGorilla 2 жыл бұрын
Thanks Alex, I'm glad the video is well received. I use this trick a lot and hope it serves you as well as it does for me. 😁
@InventarioGintracom
@InventarioGintracom 7 ай бұрын
I was searching this, and i did not find any video who can explain it in spanish, thank you!
@dmederos13
@dmederos13 2 жыл бұрын
2:35am and can't keep watching your videos🤣 This one is super handy, I feel I'm getting closer to the solution I want to implement!
@FabianH-zs1go
@FabianH-zs1go Жыл бұрын
Great Video, exactly what I was looking for! Thanks.
@williamarthur4801
@williamarthur4801 2 жыл бұрын
I enjoyed the last version as it brought up the index not showing in expand, I've always just removed everything after each and // Table.AddIndexColumn( _ , "Index", 1,1, Int64.Type) }} ) // which doesn't cause the problem of not showing index , it's not something I'd considered and it's good to be aware of these things. I enjoy your relaxed manner very much.
@BIGorilla
@BIGorilla 2 жыл бұрын
Just wow, thanks for your kind words William, I really appreciate it. These are things I've only recently learned about. After recording this video, I've delved deeper into this topic. And something I learned is how the 'type table' always allows you to indicate column types. From the sounds of it you seem interested in the topic, so please allow me to share my latest blogpost on this: gorilla.bi/power-query/creating-tables/ You will find plenty of examples that also include the relevant syntax for defining column types. Hope that helps. Enjoy Power Query! Rick
@williamarthur4801
@williamarthur4801 2 жыл бұрын
@@BIGorilla Thank you , yes I am interested , it's all the small things, i.e; I was recently using List.Accumlate to create a running total the seed is in curly brackets and I've still not really understood why apart form it's a list thing.
@BIGorilla
@BIGorilla 2 жыл бұрын
Interesting. That's a topic I haven't delved into. It will be one of my coming blogposts, just keep an eye out :)
@ThamerAffara
@ThamerAffara 5 ай бұрын
Thank you for this wonderful easy to follow!
@MaydayAggro
@MaydayAggro 10 ай бұрын
Took me forever to ask a question of Google the right way to get this video as an answer. I need to reconcile accounts with thousands of transactions per month and sometimes dozens of repeated amounts per day. Creating an index for each amount makes the job much easier, especially since my two queries do not have any like columns other than amount.
@piterkub
@piterkub 5 ай бұрын
Same here
@raulparra60
@raulparra60 2 жыл бұрын
Gracias por compartir. Como siempre muy util este tutorial. Saludos desde Bogota - Colombia
@BIGorilla
@BIGorilla 2 жыл бұрын
Mi placer!
@NSLABTUTORIAIS
@NSLABTUTORIAIS 8 ай бұрын
Thank you very much. It was what I was looking for.... Muito, muito legal!!!!!
@minadev1
@minadev1 3 ай бұрын
I am an accounting person and wanted to learn Power BI, should I start working on M language too?
@matheusgameiro61
@matheusgameiro61 Жыл бұрын
Useful bro! A manager just got mass clients transfer to his wallet, then asked me for help to get an overview about his "new wallet" what they have in pipeline, lost/cancel history and the active contracts. I needed to create a column with the most recent 3 contacts from the account, first i ordered desc, then used index and finally filtered index = 0 or 1 or 2 (top 3) ;) tks
@julliettecarignan8563
@julliettecarignan8563 9 ай бұрын
I'm curious what would be some use cases why there'd be value in having separate index sequences for the various groups? This is useful, thank you, just trying to figure out what requirement this helps us deliver (even if an intermediate one).
@chrismcgowan1078
@chrismcgowan1078 9 ай бұрын
I'm using index as primary key for a dataset (due to duplicates rows which are correct due to how the project operates). The number of rows stays the same every week but dates are updated within the dataset. I'm taking weekly copies of this dataset so that I can load them all with a date stamp column and compare week on week progress. To avoid manually adding the index column every week, grouping by date then adding the index should still create the same primary key for every row consistently each week.
@adrianacorrea5634
@adrianacorrea5634 Жыл бұрын
Yours videos are great. Thanks
@g5scosandygoodwin
@g5scosandygoodwin Ай бұрын
@BiGorilla - This is great, but it defines the index based on Column 1 and then Column 2. However, how can the Index be added based on Column 1 and Column 3 without reordering the columns. Column 1 (Color Group) and Column 3 (SalesAmount) would be a more logical indexing in your data set.
@jafarhussain4665
@jafarhussain4665 5 ай бұрын
Hi @bigorilla, Thank you for this Update, I was creating Index based on each category but before that I Did soring based on date column so that index should be done based on the sorted date. after following your procedure, id did created Index but not based on the sorted dates., it created randomly. can you please provide some solution for this
@williamarthur4801
@williamarthur4801 2 жыл бұрын
I'll Look forward to it.
@willvanluven2769
@willvanluven2769 5 ай бұрын
Awesome! True BI hero!
@pieterlinden8292
@pieterlinden8292 2 жыл бұрын
Oh, that's super handy! It lets you do the equivalent of ROW_NUMBER() OVER (PARTITION BY...) in T-SQL, but without having to import your data into SQL Server first! Then you can do things like TOPN, but at the data source level.
@nancyxu4029
@nancyxu4029 11 ай бұрын
Great! That's super helpful. Thanks!
@GabrielSantos-i4x
@GabrielSantos-i4x 5 ай бұрын
U just saved my day! Thankssss
@vncmra
@vncmra 10 ай бұрын
good morning, excellent work. what I need instead is that if the hill color group is popular and the color is black the index is one, if the two values ​​are equal, then popular and black in the next row the index is always 1 and so for the other rows . I look forward to seeing you post a similar video
@arnold5621
@arnold5621 Жыл бұрын
Thank you so much! Exactly what I've been looking for 😍
@BIGorilla
@BIGorilla Жыл бұрын
Great to hear that Arnold 🔥🙏
@williamarthur4801
@williamarthur4801 2 жыл бұрын
Re accumulate , this is slightly different to what I found online and cuts out some of the steps, add index to source, ; then insert step; Table.AddColumn(#"Added Index", "RTC ", each List.Accumulate ( #"Added Index" [Units], {0} , (Step, Current ) => Step & { List.Last(Step) + Current } ) {[Index]}) I've never really got to the bottom of the ampersand, but then I could never have crated the List.Generate Febenoci sequence either, another really good video.
@BIGorilla
@BIGorilla 2 жыл бұрын
Hey William, The ‘step’ part is the value that changes by list accumulate. List accumulate takes the function in argument 3 and applies it for n number of times. N is the number of items in the list of argument 1. What the ampersand does, is it concatenates the value of ‘step’ (which is a list) to the newly transformed value in the {} list next to it. I’m quite on the way with the article. The written version should be out by next week :)
@smartwork4768
@smartwork4768 2 жыл бұрын
Nice thank you
@BIGorilla
@BIGorilla 2 жыл бұрын
You’re welcome ☺️
@chrisbrindle6298
@chrisbrindle6298 2 жыл бұрын
Excellent! Thanks man!
@martyc5674
@martyc5674 2 жыл бұрын
Very useful 👍
@BIGorilla
@BIGorilla 2 жыл бұрын
Thank you!
@brij26579
@brij26579 2 жыл бұрын
Awesome 👌
@BIGorilla
@BIGorilla 2 жыл бұрын
Thanks ^^
@minadev1
@minadev1 3 ай бұрын
i did not quite get method 02 for indexing columns after dividing by group
@alexromera6140
@alexromera6140 7 ай бұрын
THANKS!
@Rice0987
@Rice0987 2 жыл бұрын
Oh, a bit late i've saw this video, cause i forgot a case i wanted to apply this! :( So, i need to remember this method at least for later, may be i'll remember my case. :) THANKS, Rick!
@BIGorilla
@BIGorilla 2 жыл бұрын
That’s great John, if you find the case let me know!
@JustMe-sh8nd
@JustMe-sh8nd 8 ай бұрын
gast, wauw precies wat ik nodig had, 1 tip toch, je subjects van je videos geven niet weer waar noobs op zoeken, ik zocht bijvoorbeeld op "index based on duplicate' dan kom je met deze video niet naar voren. het is dat ik geabonneerd ben en in jou lijst aan het scrollen was.
@shivamkapoor1827
@shivamkapoor1827 Жыл бұрын
How can we do multiply two columns from different tables using custom function in power query??
@Kaushal_Khunt
@Kaushal_Khunt 2 жыл бұрын
Thank you Bro
@ExcelInstructor
@ExcelInstructor Жыл бұрын
I stopped using the expand option long long time ago, its faster to convert the Column with Table objects to a list and then using Table.combine fonction on top of that list result of tables.
@ansonkong3813
@ansonkong3813 2 жыл бұрын
I like the first method
@HudaNurhuda-c7j
@HudaNurhuda-c7j Жыл бұрын
In my case, I'm using a calculated table, but the issue is that calculated tables don't show up in Power Query.
@jaggyjut
@jaggyjut 2 жыл бұрын
What if we want to reset the index end of the month. I have IT helpdesk data and like to calculate the avg number of tickets per month and year
@BIGorilla
@BIGorilla 2 жыл бұрын
In this case it sounds easier to group your data by Month-Year, and as aggregation column create columns with: - Count the number of rows that's grouped. - All Rows - Creates a table object with the grouped rows. Unpack this object and you should be good to go. You will have all your data including the a line with the number of items in the month :)
@dirkstaszak4838
@dirkstaszak4838 2 жыл бұрын
I reckon number 3 is my favourite one
@Rice0987
@Rice0987 2 жыл бұрын
I always have to sort rows in columns after some steps, sometimes several times to get exactly what i want.
@BIGorilla
@BIGorilla 2 жыл бұрын
You can sort the column before doing the group by. That should already work. In case it doesn’t work, you can wrap the table before the group by operation, in the Table.Buffer function. This forces the order to remain the same ☺️
@SamehRSameh
@SamehRSameh 4 ай бұрын
How can make this but categorized on 2 level Exambe to clarify: France lion 1 France lion 2 France paris 1 France paris 2
@magnuskrook5618
@magnuskrook5618 8 ай бұрын
🎯 Key Takeaways for quick navigation: 00:00 🧮 *Introduction to Adding Index Numbers in Power Query* - Discussing how to add index numbers to queries in Power Query for single and multiple groups. - An index number is a sequential number starting at 1, increasing for each item in a group. - Example shown with two main color groups: "other" and "popular." 02:09 🔄 *Methods for Adding Index Numbers to Grouped Data* - Demonstrating different methods to add index numbers to grouped data in Power Query. - The first method involves using a custom column and adjusting code to reference table rows in a column. - Second method streamlines the process by directly adding an index column to grouped data. 05:59 🔢 *Considerations for Data Order in Indexing* - Importance of sorting data correctly before grouping and indexing. - Demonstrates how changing the sorting order affects the index numbers assigned to different groups. - Example with color groups shows the impact of sorting order on index allocation. 07:35 🆕 *Additional Method for Grouping and Indexing* - Introducing another method for adding index numbers to grouped data. - This method involves adjusting the grouping operation in Power Query. - Highlighting the flexibility of Power Query's 'M' language for data manipulation. Made with HARPA AI
@nicolasplanchon9986
@nicolasplanchon9986 2 жыл бұрын
Great content! Would you know how to add an IF condition to the AddColumnIndex by any chance please ? Instead of iterating at every row, I would like my index to iterate only when the value of a given column changes (Source.Name in this case). Here is my current code : #"Changed Type" = Table.TransformColumnTypes(#"Filtered Rows1",{{"Source.Name", type text}, {"Team", type text}, {"Project category", type text}, {"Project type", type text}, {"Role", type text}, {"Month", type text}, {"Value", type number}}), #"Grouped Rows" = Table.Group(#"Changed Type", {"Team", "Project category", "Month"}, {{"Count", each _, type table [Source.Name=nullable text, Team=nullable text, Project category=nullable text, Project type=nullable text, Role=nullable text, Month=nullable text, Value=nullable number, Index=number]}}), #"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each Table.AddIndexColumn([Count], "#FCST", 1, 1)), This is working well but I would like to pimp my #FCST column to have the kind of index I'm looking for. Would you have any clue about this please ? Thanks in advance!
@nicolasplanchon9986
@nicolasplanchon9986 2 жыл бұрын
Hi, I finally solved my issue with this trick : #"Grouped Rows" = Table.Group(#"Changed Type", {"Team", "Project category", "Month"}, {{"Count", each _, type table [Source.Name=nullable text, Team=nullable text, Project category=nullable text, Project type=nullable text, Role=nullable text, Month=nullable text, Value=nullable number, Index=number]}}), #"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each Table.AddRankColumn([Count], "#FCST", {"Source.Name", Order.Ascending}, [RankKind = RankKind.Dense])), #"Expanded Custom" = Table.ExpandTableColumn(#"Added Custom", "Custom", {"Project type", "Role", "Value", "#FCST"}, {"Project type", "Role", "Value", "#FCST"}),
Transform Column Names in Bulk in Power Query
19:23
BI Gorilla
Рет қаралды 35 М.
Create a Running Total by Category in Power Query
17:44
BI Gorilla
Рет қаралды 31 М.
This mother's baby is too unreliable.
00:13
FUNNY XIAOTING 666
Рет қаралды 38 МЛН
Миллионер | 2 - серия
16:04
Million Show
Рет қаралды 1,2 МЛН
버블티로 부자 구별하는법4
00:11
진영민yeongmin
Рет қаралды 17 МЛН
Power Query - Adding a Conditional Index Column
12:18
BA Sensei
Рет қаралды 2,4 М.
Add index to nested tables in Power Query
5:41
Curbal
Рет қаралды 75 М.
Return Previous Row Value in Power query
9:57
BI Gorilla
Рет қаралды 27 М.
5 Best Practices in Power Query
11:31
Goodly
Рет қаралды 51 М.
Power Query: Index and Modulo Functions
15:48
Geeky Veep
Рет қаралды 63 М.
Create a Join based on Date Range in Power Query
12:00
BI Gorilla
Рет қаралды 10 М.
Advanced Group By Tricks in Power Query
14:37
Goodly
Рет қаралды 95 М.
How To Add A Conditional Index In Power Query
10:35
Enterprise DNA
Рет қаралды 7 М.