+ Reply to Thread
Results 1 to 5 of 5

Power Query to Sum If Time Within Interval

  1. #1
    Registered User
    Join Date
    10-18-2022
    Location
    miami florida
    MS-Off Ver
    latest mac os
    Posts
    3

    Question Power Query to Sum If Time Within Interval

    I have a massive XLSX export file that contains thousands of trading transactions. Sometimes there are many rows that below to the SAME order.

    I want to run a power query (or other) that will consolidate multiple rows into ONE row if the trade_done_at column is within 1 second. Since these have the same order_id these multiple rows would become ONE row. All other rows would remain untouched.

    So, in the attached file, the first 3 rows would be grouped together due to the same order_id.

    test-data.xlsx

    Column deal_price would be an avg of the values.
    Columns for amount, funds, fee would be sum of the values.
    All others would just have the same value.

    Using EXCEL for MAC - V 16.66.1

    How can I do this in excel?
    Last edited by webdevguy; 10-19-2022 at 08:52 PM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,444

    Re: Power Query to Sum If Time Within Interval

    Welcome to the forum.

    There are instructions at the top of the page explaining how to attach your sample workbook. Screenshots are of little practical use as we cannot manipulate them.

    A good sample workbook has just 10-20 rows of representative data that has been desensitised. It also has expected results mocked up, worked examples where required, relevant cells highlighted and a few explanatory notes.

    Administrative Note:

    Is you forum profile showing the version of Excel that you need this to work for?

    Members will tailor the solutions they offer to the version of Office (Excel, NOT Windows) that you have. Please check that your forum profile is up-to-date in this respect. If you aren't sure, in Excel go to File | Account and report what it says below the MS logo at the top of that page. If your version is for Mac, please also state this.

    The three most recent versions of Excel are Excel 2019, Excel 2021 and MS365 - if you are using MS365, please give this name along with the release number in your profile (e.g. MS365 Version 2211). This is in the About Excel section further down the Account page.

    Thanks.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    10-18-2022
    Location
    miami florida
    MS-Off Ver
    latest mac os
    Posts
    3

    Re: Power Query to Sum If Time Within Interval

    Thank you for the warm welcome Ali! I have edited the OP.

  4. #4
    Registered User
    Join Date
    10-18-2022
    Location
    miami florida
    MS-Off Ver
    latest mac os
    Posts
    3

    Re: Power Query to Sum If Time Within Interval

    Can anyone help please?

  5. #5
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Power Query to Sum If Time Within Interval

    is that what you want?

    I forgot about 2 or 3 columns but hope you can fix it yourself
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Power Query - How to use Time Duration hh:mm:ss
    By NewYears1978 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-10-2022, 11:27 AM
  2. How to add date/time to Power Query
    By wnt9080 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-23-2021, 03:02 AM
  3. Replies: 4
    Last Post: 02-17-2020, 06:03 AM
  4. Sub-Forum for Excel Power Tools (Power Query, Power Pivot & Power BI)
    By chullan88 in forum Suggestions for Improvement
    Replies: 10
    Last Post: 06-28-2018, 02:25 PM
  5. Power query - time to hours
    By orhanceliloglu in forum Excel General
    Replies: 1
    Last Post: 05-24-2018, 04:41 AM
  6. Power Query Date Time
    By jcmckeon in forum Excel General
    Replies: 5
    Last Post: 09-12-2017, 02:19 PM
  7. Replies: 0
    Last Post: 04-23-2012, 10:06 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1