Heidi Lehr 2 Posted April 8, 2022 Share Posted April 8, 2022 I am using Spotfire 11.x. Below is a table of data that I am trying to get the days between the next delivery date so I can get a qty/day for analysis. This is all for one well and I am not sure how to do an over statement that will use Wellname & Chemical. I wasn't sure how to use a multiple intersect in an over expression to get the datediff from the next row, in time sequence. Any suggestions, or can this even be done I even tried a ranking based on Wellname, Chemical, Date. Date Qty $/gal Chemical Chemical Type 11/30/2021 55 1.00 DMO-2063 Demulsifier 1/11/2022 55 1.00 DMO-2063 Demulsifier 9/21/2021 55 2.00 SCV-3004 H2S Scavenger 11/2/2021 55 2.00 SCV-3004 H2S Scavenger 11/30/2021 55 2.00 SCV-3004 H2S Scavenger 1/28/2022 55 4.00 PIO-1073 Paraffin Inhibitor 3/1/2022 55 4.00 PIO-1073 Paraffin Inhibitor 1/11/2022 55 3.00 SCW-4097 S/C Inhibitor 3/1/2022 55 3.00 SCW-4097 S/C Inhibitor Link to comment Share on other sites More sharing options...
Fredrik Rosell 3 Posted April 13, 2022 Share Posted April 13, 2022 Hello, To ensure that any responses are relevant for the particular TIBCO product that you are using, please add a note about what that product is (or edit the question, and select a product in the Product field). Best Regards Fredrik Link to comment Share on other sites More sharing options...
Fabian Duerr Posted April 14, 2022 Share Posted April 14, 2022 Yes, you can use ranking to create a column that will help you: Rank([Date],[Wellname],[Chemical])Then create another calculated column to find the previous date: First([Date]) OVER (Intersect([Wellname],[Chemical],Previous([your.rank.column])))Finally, use the DateDiff() function to get the number of days. Link to comment Share on other sites More sharing options...
Heidi Lehr 2 Posted April 18, 2022 Author Share Posted April 18, 2022 Thx! That works to get the previous date. I guess I should have been a little better in describing what i need. I need to get the next date so I can calculate usage between delivery dates. Delivery Date Rank Chemical qty Prev Del Date Next Date Diff GPD 11/30/2021 1 DMO-2063 55 1/11/2022 42 1.31 1/11/2022 2 DMO-2063 55 11/30/2021 1/28/2022 1 PIO-1073 55 3/1/2022 32 Link to comment Share on other sites More sharing options...
Fabian Duerr Posted April 18, 2022 Share Posted April 18, 2022 The date difference will not change anyways. ;) Just the data row will change, if you work with Next() instead of Previous() Not sure if you found the solution yourself, so here are the three columns you need Rank([Date],[Chemical]) First([Date]) OVER (Intersect([Chemical],Next([your.rank.column]))) DateDiff('day',[Date],[your.next.date.column]) Link to comment Share on other sites More sharing options...
Heidi Lehr 2 Posted April 18, 2022 Author Share Posted April 18, 2022 Oh heck...I was trying to put next in the wrong place so I couldn't get it to work. Thx! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now