Questions tagged [lead]

Accesses data from a subsequent row in the same result set without the use of a self-join in SQL Server 2017. LEAD provides access to a row at a given physical offset that follows the current row. Use this analytic function in a SELECT statement to compare values in the current row with values in a following row.

For further reading https://learn.microsoft.com/en-us/sql/t-sql/functions/lead-transact-sql

309 questions
1
vote
1 answer

Create lead and lag variables in R

I have to create lead and lag variables like below in R Suppose i have a dataframe which has details about a customer's visit to any store... CustomerID Dateofvisit 1 1/2/2013 1 1/3/2013 1 1/7/2013 2 1/9/2013 2 1/14/2013 2 2/14/2013 3 …
user2724207
1
vote
1 answer

SAS: Shift date by one period

I have a DATE variable in my dataset in monthly format (Example: Ob1=5/1/2013, ob2=6/1/2013 etc). I want to shift the dates back by one period. That is, for the entire row of data (18 variables), what was 6/1/2013, will now be 5/1/2013, under the…
Siftekhar
  • 153
  • 2
  • 7
0
votes
2 answers

SugarCRM edit lead forms "Edit View" and "Quick Create"

I have altered the "edit view" and "quick create" forms for the lead but there is this primary address block that always appear in the middle of the form. How can I remove that ? Please take a look at the snapshot to have a closer look into the…
Omayr
  • 1,949
  • 4
  • 22
  • 35
0
votes
1 answer

Dependent Dropdown lists in SugarCRM 6.4

I have added a couple of custom fields in leads module from the studio. I am trying to implement dependency on the dropdown lists using the this tutorial but somehow it doesn't seem to work. I have checked it over and again my code is the same as in…
Omayr
  • 1,949
  • 4
  • 22
  • 35
0
votes
1 answer

Using LEAD and LAG on ragged time series

I have a large dataset and want to retrieve previous and subsequent observations for small windows. Below is a snippet around a window of interest (2024-09-23 to 2024-09-27). item date price A 2024-09-20 $106.59 A 2024-09-23 $91.84 A…
Misha
  • 95
  • 6
0
votes
1 answer

Sql server min and max dates between 2 columns and multiple rows

In Sqlserver 2019 script, I have a table for employee leaves like below format For example employee has consumed his annual leave days as mentioned below Empcode LeaveFrom LeaveTo A 23/07/2023 01/08/2023 02/08/2023 …
lingaiah
  • 21
  • 2
0
votes
1 answer

LEAD function in SQL query not getting desired result

I'm trying to get an entry from a table that has START_TIME and FINISH_TIME. If FINISH_TIME is null then have to get the next START_TIME. Below is the query I tried, also have to use the lead function for optimization CREATE TABLE RUN_LOG ( ID…
Vasanth
  • 25
  • 5
0
votes
0 answers

Tracking leads generated from messenger apps via website click

I like to know if Firebase can track leads generated from messenger apps via website click. The user journey would be: User sees ad -> Lands on brand website -> Clicks on messenger button or scans QR code to open Messenger app -> Messenger app opens…
0
votes
2 answers

How to get the latest change from a table per ID

I have a table like ID TYPE START END TIMESTAMP_ 1 A NULL 5 '2022-03-03' 1 B NULL 7 '2023-07-19' 1 A 5 NULL '2023-07-20' 1 B NULL 7 '2023-07-21' 4 A NULL 20 '2023-06-30' 4 A 20 17 '2023-07-01' I am trying to get the latest…
0
votes
2 answers

Find time difference between non-consecutive rows depending on column values in Athena

I have a dataset with conversation data between a User and a Customer Service. I need to find the response time (time difference) between after a user sent a message and first time the Customer Service responded to the message What I struggle with…
KaraiKare
  • 155
  • 1
  • 2
  • 10
0
votes
1 answer

Desire correct row numbers using over PARTITION BY for invoices transaction

I have a set of data containing invoice information. The goal is to find the credit and rebill invoice number ('InvcNbrKey') associated with a particular 'Standard Order' line. Think of it as a person orders an item which generate a line with…
Thien Pham
  • 43
  • 1
  • 9
0
votes
1 answer

Assign Unique Group ID based on the time an event happened (within 60 minutes of each other)

Is there a way to assign unique Group ID to rows in SQL based off on how much time is between each one (in this case 60 minutes). For patient 614 I would like to start the first row at 12:50pm and that would be Group ID 1 and since the next BP is…
0
votes
0 answers

How to Automatically Assign Owner to New Generated Lead through Zapier?

I am currently working on setting up an automation process for my business where new leads generated through Zapier are automatically assigned to a designated owner within our team. I am using Zapier to generate leads, but I am having difficulty…
MEHRAN ALI
  • 33
  • 3
0
votes
3 answers

SQL query to pick the next change Date from the next row based on same Brand

Requirement is to pick the next change date from the following table as RetailDate Brand IdBusinessUnit 2023-02-05 B Series 2 2023-02-07 B Series 2 2023-02-07 Equity 2 2023-02-15 Equity 2 2023-02-21 ALL 2 2023-03-10 B…
0
votes
0 answers

Get the Time_stamp When value of tag changed from 1 to 2 and toggled

I am having a Table contain two columns named Time_stamp and PWPH_Pmp_2_FBSts and table name is per_hour_log The Sample of A Screen Shot I embedded for the reference.The Query Which I Wrote is as follows SELECT MAX(time_stamp) AS…