Avg. Time between purchase orders

sarahi6
sarahi6 Member
edited March 2023 in Datasets

Hi,

Domo newbie here.

I am trying to find the average time between orders. The columns I have are

  • Customer ID
  • First Purchase date
  • Last Purchase date
  • Time between purchases

I tried to using the group by function to find the average time between orders, but it seems to be returning the same value as the 'time between purchases' column


Anyone have ideas of how to fix this in Magic ETL?


Thank you !

Tagged:

Comments

  • Hi @sarahi6 can you please share a screenshot of your group by function?

  • Sure @MichelleH ! Here is how I set up the group by function

  • mhouston
    mhouston Contributor

    @sarahi6 because you have start and end date in your group on columns, you are only finding the average time between purchases on the same start and end date. I am assuming you want to find the average time between purchase by customer, so you will want to just group on customer id (remove the start/end date columns).


  • Yes @mhouston , I do want to find the average time between purchases. After changing the group by set up - I did notice that the value for the new 'avg. time between purchase' is returning the same value as the original 'time between purchase' column.

  • @sarahi6 That would make sense that the "Avg Time Between Purchase" is the same, since the "First Purchase Date" and "Last Purchase Date" would be the same across all rows of the same Customer ID. If a customer has purchases on January 1, May 1, and August 1, then you would be comparing the difference between January 1 and August 1 for the customer overall.

  • RobSomers
    RobSomers Coach
    edited August 2022

    @sarahi6 Are you wanting for each line to have the average time between purchases for all customers? If so, you'll want to use a Rank & Window tile to do that.

    https://domohelp.domo.com/hc/en-us/articles/360042922814-Old-Magic-ETL-Tiles-Rank-and-Window

    **Was this post helpful? Click Agree or Like below**

    **Did this solve your problem? Accept it as a solution!**

  • @RobSomers Yes, I want each and average time between purchases for all customers. Will I keep the group by function that I listed above, and then add the rank & window?

  • You won't need your group by tile, just the Rank & Window tile.

    **Was this post helpful? Click Agree or Like below**

    **Did this solve your problem? Accept it as a solution!**

  • @RobSomers , did I set this up right? I clicked the link you provided but I am having a hard time understanding what I should put as my preceding and following values.


    thanks!

  • I actually think a better and easier way to do this would be using the FIXED function. You can do this either using a formula tile or using a beast mode in a card. The formula will be like this:

    AVG(AVG('Time between purchase')FIXED())

    I don't think the FIXED function will show up in the list of formulas in the ETL, but it should still work.

    **Was this post helpful? Click Agree or Like below**

    **Did this solve your problem? Accept it as a solution!**