Running Totals in Excel's Power Query: the easy way

แชร์
ฝัง
  • เผยแพร่เมื่อ 25 ธ.ค. 2024

ความคิดเห็น • 93

  • @beautywithbrilliance
    @beautywithbrilliance 4 ปีที่แล้ว +1

    Amazing video. Saw so many blog posts but your solution seems the best and the easiest.

  • @mikemorrow3346
    @mikemorrow3346 4 ปีที่แล้ว

    consistently amazed and grateful for all the intelligent people out there willing to share their knowledge with others!

  • @JR-ly6bx
    @JR-ly6bx 6 ปีที่แล้ว +2

    Great lesson, you must have a full production team putting your videos together, I've never seen so much animation in a tutorial video, it's like going to a party. Thanks for the Get Transform, Lynda.com lessons. Your the first one to teach me Power Query, and I just passed my 70-779 certification!!

    • @OzduSoleilDATA
      @OzduSoleilDATA  6 ปีที่แล้ว

      JR you're so welcome! I'm glad you liked the Lynda courses.
      The video production is all me. It takes a lot of time and I enjoy it. It's good to know that others find value in it. 👍👍👍

    • @OzduSoleilDATA
      @OzduSoleilDATA  6 ปีที่แล้ว

      JR congrats on passing your certification! 🎉🎉🎉🎉💃🕺💃🕺💃🕺

  • @maffuccic
    @maffuccic 4 ปีที่แล้ว +1

    This saved me so much time. Very helpful.

  • @barttitulaerexcelbart9400
    @barttitulaerexcelbart9400 7 ปีที่แล้ว +2

    Oz, thank you for sharing all the knowledge and simplify this topic. If your data is processed in Excel I would like to suggest another solution: 1: import an Excel table in PQ. 2: just give the table back to Excel (green table). You can add a formula on the right: SUM($C$5:C5) copy down. (Assuming in D5 is the first running total). If you add new data to the excel table and click refresh and enjoy this solution as well....:)

    • @OzduSoleilDATA
      @OzduSoleilDATA  7 ปีที่แล้ว +1

      I like that strategy! YEAH! I can see it.

    • @its8524
      @its8524 6 ปีที่แล้ว

      That's a good idea....but power query is generally used for handling large sets of data...and for such data it will be difficult to use functions back into excel as even running a small fiction like sumifs will be too much memory consuming.

  • @bricc322
    @bricc322 7 ปีที่แล้ว +3

    Much easier, this one! On the other hand, the other video taught me lots of good stuff. Thank you, Oz and all the other awesome "pirates" riding Ubers! :-D

    • @OzduSoleilDATA
      @OzduSoleilDATA  7 ปีที่แล้ว +1

      Thank YOU!
      Uber Pirates. I like that. I like that.

  • @rachaelhanna8523
    @rachaelhanna8523 5 ปีที่แล้ว +1

    Thanks Oz, very helpful and explained clearly and step by step

  • @lynxwomancat
    @lynxwomancat 6 ปีที่แล้ว +1

    Thanks, Oz. I love the collaboration. Four heads are better than one LOL. Stay On Fiya!

    • @OzduSoleilDATA
      @OzduSoleilDATA  6 ปีที่แล้ว +1

      YES YES! I love the collaboration. It keeps the fire from going out. 😊

  • @excelisfun
    @excelisfun 7 ปีที่แล้ว +1

    Fire and Running Totals are fun !!!! Thanks : )

    • @OzduSoleilDATA
      @OzduSoleilDATA  7 ปีที่แล้ว

      ... and BeeGees!

    • @excelisfun
      @excelisfun 7 ปีที่แล้ว +1

      1970s disco : ) They did not have Uber back then, or TH-cam!!!

    • @OzduSoleilDATA
      @OzduSoleilDATA  7 ปีที่แล้ว

      It's a new type of experience: cross-generation mashup 🔥🔥🔥🔥

  • @waverider80
    @waverider80 5 ปีที่แล้ว +1

    Perfect - solved my problem. Couldn't ask for anything else.

  • @FRANKWHITE1996
    @FRANKWHITE1996 4 ปีที่แล้ว +1

    Sir! Thanks to you, my excel is on fire!!! Thanks 🔥🔥🔥🔥

    • @OzduSoleilDATA
      @OzduSoleilDATA  4 ปีที่แล้ว +1

      FRANK!
      Excel! Excel
      Excel is on fire!
      We don't need to water,
      let the mofo burn ... 🔥🔥🔥

    • @FRANKWHITE1996
      @FRANKWHITE1996 4 ปีที่แล้ว

      @@OzduSoleilDATA 🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥

  • @gabrielgabriel2646
    @gabrielgabriel2646 5 ปีที่แล้ว +1

    Even more magic than the previous one!!! Have a good day in Oz Land!!!!

  • @marceloalmeida1044
    @marceloalmeida1044 5 ปีที่แล้ว +1

    It really works fine thanks I was desperately looking for it. But loading is taking way too much time, too much slow. My table has nearly 50 Thousand lines. Is there a solution for this? Till there, I am doing it just by the table with simple excel formulas. Working fine too, and faster. But the data doesnt belong to the data model this way. Thanks again!

  • @janwillemvanholst
    @janwillemvanholst 6 ปีที่แล้ว +1

    Thanks. Small (syntactic) enhancement suggestion: replace List.Range with List.FirstN. You can skip de 0.

  • @stevennye5075
    @stevennye5075 5 ปีที่แล้ว +1

    Well done!

  • @jeromeastier462
    @jeromeastier462 5 ปีที่แล้ว +1

    Great Video, Thanx!!

  • @powershah
    @powershah 6 ปีที่แล้ว +1

    Great video.

  • @EricGiroux
    @EricGiroux 7 ปีที่แล้ว +1

    Hi Oz,
    Thanks to everyone! ;-) Nested M fonction, that's how I like it!

    • @OzduSoleilDATA
      @OzduSoleilDATA  7 ปีที่แล้ว

      Yes yes! Much cleaner. I like it that way, too.

  • @diegopagura421
    @diegopagura421 6 ปีที่แล้ว

    Hi! Great tip for running totals. It's simple and does not require much work.
    Quick question though. What happens if I want to add running subtotals by a certain parameter. Let's say that your file has an additional column for "Store". Where you have Store A, Store B, Store C, etc.
    And you want to have the running total by store. So, every time a new Store comes in the list, it resets the running total to 0.
    How can I do that?
    thanks again!

  • @adan507
    @adan507 5 ปีที่แล้ว

    Very helpful! can you think of a way of doing a double running total for two different columns? for example visits and profit of each day in your example

    • @OzduSoleilDATA
      @OzduSoleilDATA  5 ปีที่แล้ว

      That's a tough one. My friend Faraz solved this challenge here: th-cam.com/video/uvOX-Oy-Zdk/w-d-xo.html

  • @1yyymmmddd
    @1yyymmmddd 6 ปีที่แล้ว +1

    Will this work with few millions of rows? If List function stores values in memory then we might have problems, wouldn't we?

    • @OzduSoleilDATA
      @OzduSoleilDATA  6 ปีที่แล้ว +1

      My understanding is that this should work on millions of rows. One limitation is that you can't load millions of rows onto a worksheet.

  • @luiscosta7347
    @luiscosta7347 6 ปีที่แล้ว

    Great video.
    If we had the total entries by gate (e.g. by extra column GATE Numb), and I want to have the running totals by gate. Is it possible to do by this way?

  • @5Silko5
    @5Silko5 6 ปีที่แล้ว +1

    Thanks for this, greate video! Is there a way to do this by categories? Additional column category -> running totals by category.

    • @OzduSoleilDATA
      @OzduSoleilDATA  6 ปีที่แล้ว

      I'm sure there's a way. That'd take a bit of research. What's an example you'd have in mind?

    • @5Silko5
      @5Silko5 6 ปีที่แล้ว +1

      I need a running total of products stock by time of warehousing. Table has many products in different warehouses. I would like to calculate a running total by product and by warehouse. So the columns of the table would be: Date of warehousing, warehouse, product, amount, running total of amount by product and warehouse.

    • @OzduSoleilDATA
      @OzduSoleilDATA  6 ปีที่แล้ว

      GOTCHA!
      This is interesting. I don't have an immediate solution, though. My initial thought is to pull the different pieces apart, do the running totals, then put them back together. But that would get really messy if you have more than, say, 3, running totals.
      A quick search shows a lot of people have this question and they opt to handle it in PowerPivot. This would be pretty easy in native Excel, but I'm not envisioning a clean way of doing it in Powery Query. But you got me thinking.

    • @5Silko5
      @5Silko5 6 ปีที่แล้ว +1

      I have to add this. It has to be in power query because there is a lot of data and DAX would not handle it. Also, there are a lot more than 3 running totals. I think about 10 different warehouses. And more than 1000 different products. I have found this example: onedrive.live.com/view.aspx?cid=4fa287bbc10ec562&page=view&resid=4FA287BBC10EC562!12099&parId=4FA287BBC10EC562!398&app=Excel
      But I could not manage to make it work on my data.

    • @OzduSoleilDATA
      @OzduSoleilDATA  6 ปีที่แล้ว

      Yeah. That method in OneDrive is a kind of "pull it apart and put it back together" solution. Not suitable for your need.

  • @DroneEyesInTheSkies
    @DroneEyesInTheSkies 5 ปีที่แล้ว

    Hi There, thank you for this! How do you figure out the opposite? How do you figure out the period value if you have a cumulative value for every day?

    • @OzduSoleilDATA
      @OzduSoleilDATA  5 ปีที่แล้ว

      I'm not sure what you're asking.

    • @raphael994
      @raphael994 5 ปีที่แล้ว

      Excel On Fire the video you showed displays for a way of calculating a running total from individual increment values. However, sometimes you might have the running total and you are trying to determine the original increments by month. A reverse running total essentially is what I’m asking.
      From a running total, which is the result of what you’ve done, if you already have these values and want to work backwards to obtain the incremental values. :) Any ideas on this?

  • @asimkumarchakraborty2456
    @asimkumarchakraborty2456 6 ปีที่แล้ว +2

    Sir have tried this =List.Sum(List.FirstN(#"Added Index"[visitors],[Index])) but all from you, your videos just change my idea.we required more videos at least once in a week.

    • @OzduSoleilDATA
      @OzduSoleilDATA  6 ปีที่แล้ว +1

      I'm trying. Once-a-week is hard. But I'm trying. ⚔

  • @entertainmentgalaxy971
    @entertainmentgalaxy971 7 ปีที่แล้ว +1

    Super fun to add running totals with PQ...

  • @wesszep9865
    @wesszep9865 7 ปีที่แล้ว +1

    Thanks very very impress, thanks Oz.

    • @OzduSoleilDATA
      @OzduSoleilDATA  7 ปีที่แล้ว +1

      Very very you're welcome, Wess!

  • @ThatOtherOakDaniel
    @ThatOtherOakDaniel 6 ปีที่แล้ว +1

    I would have cussed, but out of politeness, I won't. Thank you. This is useful.

  • @nononsense129
    @nononsense129 7 ปีที่แล้ว +1

    Excellent 👍

  • @ExactProBi
    @ExactProBi 6 ปีที่แล้ว

    How to do running totals in monthly fashion (MTD) in Power Query? also category wise (Sales, Cost of Sales etc)?

  • @lynxwomancat
    @lynxwomancat 6 ปีที่แล้ว

    Oz, does the sorted column in the PQ adjust to all source data sorts? Meaning, if the source data is sorted a different way, do you have to match that sort type in the PQ each time or does the sort step in PQ adjust to any sort done in the source data? Is that clear as mud? LOL

    • @OzduSoleilDATA
      @OzduSoleilDATA  6 ปีที่แล้ว +1

      The sort in the query puts things in order so that the running total is meaningful. The source data could be completely out of order. Does that answer your question?

    • @lynxwomancat
      @lynxwomancat 6 ปีที่แล้ว +1

      Yessir! Thank you!

  • @samtailor4622
    @samtailor4622 6 ปีที่แล้ว

    How can i make a running total by a segment? Lets say you have 2 products and you want a running total to be calculated individuality for each product every day?

  • @cbrunelle76
    @cbrunelle76 4 ปีที่แล้ว +1

    Bon bagay!

  • @shoebhakeem3131
    @shoebhakeem3131 5 ปีที่แล้ว

    Hey Oz!! Wiz the code keeps loading and makes the query very very damn slow!! Any comments on this please..

    • @OzduSoleilDATA
      @OzduSoleilDATA  5 ปีที่แล้ว

      I have no idea what that could be.

  • @khanaramey1730
    @khanaramey1730 5 ปีที่แล้ว +1

    Thank you for this! This seems to take a lot more mental energy for Excel to do this in PQ vs. doing a running total in a Pivot Table, or even doing a sum with an absolute value at the beginning of the range. Would you say that it is a best practice NOT to use PQ for running totals if you can avoid it? - Signed, your new Work Wife

    • @OzduSoleilDATA
      @OzduSoleilDATA  5 ปีที่แล้ว +1

      AH! My new Work Wife! HOTDOG!
      👑
      I agree with you. Running totals are complex in Power Query when compared to staying in Excel and using SUMIFS or a pivot table. I know I'd try to avoid it in PQ, but we know that it's possible in case you're forced to be in PQ and need something fully automated.

  • @joshschaffer3142
    @joshschaffer3142 6 ปีที่แล้ว +1

    nice

  • @wynhopkins4023
    @wynhopkins4023 7 ปีที่แล้ว +2

    Personally I think I rock that party hat #MVPNewbie 🤣

    • @OzduSoleilDATA
      @OzduSoleilDATA  7 ปีที่แล้ว +1

      You do!!!! You do!! 🔥🔥🔥🔥🔥🔥 #MVPNewbie

    • @barttitulaerexcelbart9400
      @barttitulaerexcelbart9400 7 ปีที่แล้ว +1

      Hello Wyn: congratulations for being MVP, I like your enthusiasm about Power BI. !!

    • @wynhopkins4023
      @wynhopkins4023 7 ปีที่แล้ว

      Hi , thanks Bart

  • @1yyymmmddd
    @1yyymmmddd 6 ปีที่แล้ว

    I have tried this technique in a function and strangely enough it does not work there.

    • @OzduSoleilDATA
      @OzduSoleilDATA  6 ปีที่แล้ว

      I haven't tried this as a function

    • @1yyymmmddd
      @1yyymmmddd 6 ปีที่แล้ว

      It looks like one has to be very careful about data formats. Column in General format adds up just fine in stand-alone query, but seems to fail if you put it in a function. It works fine in both places if I format column as Decimal or Integer.

  • @antoniorasco1928
    @antoniorasco1928 2 ปีที่แล้ว

    No need to sort - List.Sum(List.FirstN(#"Added Index"[Visits],[Index])

  • @thearmybender
    @thearmybender 6 ปีที่แล้ว +1

    How about just 2 steps instead?
    Source = #"Base Data"
    #"Added Index" = Table.AddIndexColumn(Source, "Index", 1, 1),
    #"Added Running Total" = Table.AddColumn(#"Added Index", "Running Total", each List.Sum(List.FirstN(#"Added Index"[Amount],[Index])))