Reference previous row/other rows in Power Query

Поделиться
HTML-код
  • Опубликовано: 11 сен 2024

Комментарии • 40

  • @wayneedmondson1065
    @wayneedmondson1065 2 года назад +3

    Hi David. Just found your channel. Awesome example! For the simple scenario, the merge query step throws the top row to the bottom, so you have to remember to sort by the 0 Index column before close and load. Another method I employ is to bypass the query merge step. Instead, add only the 0 Index column and then add a custom column with the following (using your columns as example) = try Source[#"Tests (cummulative)"]{[Index]-1} otherwise null. This will produce the desired column with reference to the prior row value with null at the top. Also, you don't have to sort. I'm sure you know this method. Just posting it for others if interested. Of course, wouldn't work for your complex example. Thanks for sharing your videos. Subscribed and looking forward to more. Thumbs up!!

    • @learnspreadsheets
      @learnspreadsheets  2 года назад +1

      Thanks Wayne! Yes that’s a great suggestion using custom code, I’ll have to try it myself!

    • @wayneedmondson1065
      @wayneedmondson1065 2 года назад +1

      @@learnspreadsheets Awesome! Cheers :))

  • @gborka
    @gborka 2 года назад +4

    Great content.
    To shift rows with Index0 Index1, simple and genius.
    Will be really helpful at hunting irregularities in time series data. One more block for proper data validation by PQ.
    On the second part of the video, sure, I should dig more, the treasure ahead.
    Thanks a lot, David.

  • @joseantoniolopezmesa6807
    @joseantoniolopezmesa6807 2 года назад +1

    I loved the trick, but I also loved how in a subtle way you invited people to follow your content. More people on youtube should do it similarly I think

  • @Hamish_A
    @Hamish_A Год назад +1

    Fantastic! This is such a clear explanation and opens up a while new set of possibilities in power query!

    • @learnspreadsheets
      @learnspreadsheets  Год назад

      Yes!! Love the possibilities this feature can unlock 🙃

  • @shubhabratadey
    @shubhabratadey Год назад

    This is by far the best and simplest of many videos to understand...Many many thanks..😊

    • @learnspreadsheets
      @learnspreadsheets  Год назад +1

      That's very kind! I worked hard on it, so I'm happy you found it useful! I just published a new short Power Query video now!

  • @barttitulaerexcelbart9400
    @barttitulaerexcelbart9400 3 года назад +1

    Very good David. Also the small tips: like the way you rename the merged columns. Excellent. By the way: you can somehow fill down in regular Excel: just select the range, F5 go to special, blanks and refer to the top cell, press ctrl-enter.....

    • @learnspreadsheets
      @learnspreadsheets  3 года назад

      Thanks Bart! Glad you like it. Yes I know the excel fill down train too 😃

  • @FTSociety
    @FTSociety Год назад

    Wow, I didn't knew you could merge queries using the same query itself, thank you!!!

  • @xyclos
    @xyclos 2 года назад +1

    David, thanks a lot!! Fantastic!!

  • @learningsessions4584
    @learningsessions4584 3 года назад +1

    Hi David, that was the best video for referring to previous/next rows I have come across. Thanks for sharing, this was very useful. Would be great if I can get the file to follow along with the video. 😊

    • @learnspreadsheets
      @learnspreadsheets  3 года назад

      Hi yes glad you like it, I use this trick like all the time! Ah I don’t think I still have the file but maybe email me and I can see what I can do david@xlconsulting-asia.com

  • @youritomo
    @youritomo Год назад +1

    🤠Thank you for just an easy method!!!

  • @Schnellhilfe-ThemenKurzAufdenP
    @Schnellhilfe-ThemenKurzAufdenP 2 года назад +1

    Now I understand the purpose of selfjoin, cool!

  • @CeliaAlvesSolveExcel
    @CeliaAlvesSolveExcel 3 года назад

    Great tricks, David! Very useful!

  • @tommijansson6037
    @tommijansson6037 Год назад

    This was exactly what I was looking for so thanks for the video David, but what if you don't have every single dates on your data, if there are only workdays or some reason a date could be missing - how would you create that custom column for "yesterday" which could be last Friday if you don't have weekends in your data?

    • @learnspreadsheets
      @learnspreadsheets  Год назад

      Heya! Thanks for the feedback, glad you liked it, that would get a bit trickier but here is a forum question on it

  • @jmclean981
    @jmclean981 11 месяцев назад

    Great video David!!! How about if the dates are NOT consecutive?

    • @learnspreadsheets
      @learnspreadsheets  11 месяцев назад

      Hmm I would say as long as dates are sorted the same idea could work

  • @aymanraouf1820
    @aymanraouf1820 2 года назад +1

    Thank you for the video. I am trying to classify something based on a previous row. Can that be achieved. So if C3="Green", then B2="the previous record is green"

    • @learnspreadsheets
      @learnspreadsheets  2 года назад

      Yea that works, use the trick i shiw in the video to get the previous row in the current one then add a conditional column with the criteria you need

    • @aymanraouf1820
      @aymanraouf1820 2 года назад

      @@learnspreadsheets After having two columns, i am trying to make a third column produced that makes one value of the column supercede the second column. Can that also be achieved

  • @JD-29
    @JD-29 3 года назад +1

    Hi david loving your videos! Is it possible to get a currency conversion spreadsheet? Thank you

  • @luddawankhumprasit6689
    @luddawankhumprasit6689 2 года назад +1

    Thank you so much

  • @kohkombero
    @kohkombero 2 года назад

    Will look at the 2nd option more closely. I have "check in" and "check out" on individual rows. I can identify them by person Id. Unfortunately not every "check in" event is followed by "check out". Any tips how to get adjecent "check in & out"-pairs of same person spotted correctly, disregard events where is only in OR out stamp? Direct indexing doesn't work as it will - in case of missing in OR out stamp - merge to rest of a single person id incorrect check type to row

    • @learnspreadsheets
      @learnspreadsheets  2 года назад

      Hmm that sounds more complex would need to think about it but I think you’re on the right lines and should eventually figure out a way

  • @moncyfrancis8180
    @moncyfrancis8180 7 месяцев назад

    hi how we can refer the row in the custom colum formula

    • @learnspreadsheets
      @learnspreadsheets  6 месяцев назад

      Hi the video explains various methods, it’s not as easy as it should be though!