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
3
votes
1 answer

When I use the lag function, how do I "skip" dates in previous rows that are the same as the date in the current row?

I have a dataframe with columns 'person', 'NoShow', and 'date'. Person NoShow date 1 334 1 2019-07-07 2 334 1 2019-10-11 3 334 1 2020-07-07 4 334 1 2021-01-04 5 999 1 2021-06-03 6 999 1…
Rene
  • 81
  • 5
3
votes
2 answers

dplyr::lead or data.table::shift refer to variable value rather than scalar

Given: library(tidyverse) df <- data.frame(id = c(1, 1, 1, 1, 1, rep(2, 5), rep(3, 3)), dates = as.Date(c("2015-01-01", "2015-01-02", …
user63230
  • 4,095
  • 21
  • 43
3
votes
1 answer

R - logical statement with leads and lags

I have a vector of numbers and want to check whether there is any zero that is surrounded by two identical numbers e.g.: x <- c(3,0,3,4,5,2,0,1,3) any(x == 0 & lag(x) == lead(x)) TRUE The problem is however that if the vector starts or ends with…
3
votes
2 answers

Get the first non zero digit in R similar to Mathematica

In mathematica we have RealDigits that can identify the first non-zero number for both numbers with decimal point and integer values. See below as an example: RealDigits[ 0.00318, 10, 1] {{3},-2} RealDigits[ 419, 10, 1] {{4},-2} In the above…
forecaster
  • 1,084
  • 1
  • 14
  • 35
3
votes
1 answer

How to get the next next to last value if previous value is null

I am trying to clean up a table that basically fill up all the empty value from the 1st non-null value. The sample table: ID Number Type 1 51280 % 1 A 2 51279 % 2 B 3 50631 % 3 A 3 B 3 C There is…
MrMuffin
  • 53
  • 1
  • 2
  • 7
3
votes
5 answers

apply lag or lead in increasing order for the dataframe

df1 <- read.csv("C:/Users/uni/DS-project/df1.csv") df1 year value 1 2000 1 2 2001 2 3 2002 3 4 2003 4 5 2004 5 6 2000 1 7 2001 2 8 2002 3 9 2003 4 10 2004 5 11 2000 1 12 2001 2 13 2002 …
Robby star
  • 281
  • 2
  • 13
3
votes
2 answers

Using LEAD in BigQuery

Assume my table structure is this I am planning to group it by (USER and SEQUENCE ) and get the LEAD timestamp for the next sequence. Here is the output that I am looking for Can I solve this without JOIN using LEAD function if possible ?
phaigeim
  • 729
  • 13
  • 34
3
votes
1 answer

How to get leads details in SalesForce with the REST API?

Is it possible, with the REST API available from SalesForce, to get the list of all leads and all their details?
herve
  • 525
  • 6
  • 17
3
votes
1 answer

Regarding Facebook fbq('track', 'Lead'); - is there a way to track different kind of leads?

in example - I have a webpage with 2 buttons - 1. Call 2. SMS I want to separate Leads for that (let's call it Lead_call and Lead_sms), since I want to run campaigns that focus optimisation per action (1 for Lead_call and 1 for…
Gadi Ben Amram
  • 197
  • 1
  • 3
  • 13
3
votes
3 answers

What's the R equivalent of Stata's _n function?

I am wondering whether there is a function in R like in Stata, where you are able to use the value of the observation n numbers before or after each observation. For instance if I need to multiply or divide with the observation before I would write…
3
votes
1 answer

Finding difference in months using analytical function in oracle

I have data like below. In this I need to find rows where the diff in their months should be >= 6. The logic should be, we need to compare from first row until we got the row where diff in months is 6, then need to follow the same logic from the…
arunb2w
  • 1,196
  • 9
  • 28
3
votes
9 answers

What does your team do to stand out?

Where I work, we have small teams of 2 - 5 people. As a dev lead, what are some things that you've implemented which makes your team stand out from the others? Meaning, it makes the others teams say, "that's cool" or "why didn't we think of that".…
4thSpace
  • 43,672
  • 97
  • 296
  • 475
2
votes
1 answer

How to make a lead have multiple opportunities on SugarCRM 6.3 CE?

I need to make a lead convert (and relate to) 1 or more opportunity on SugarCRM. With just one lead it's easy, I just have to set the 'opp_id' field - however, with multiple leads I'm not able to do that. I need at least to create a relationship…
Lucas Famelli
  • 1,565
  • 2
  • 15
  • 23
2
votes
1 answer

How to hide chatter to a specific user group odoo 14?

I need to hide the chatter from the form view of the crm module for a specific group of users. How can I do this?
oigna
  • 121
  • 7
2
votes
1 answer

Replace subsequent values in a df based on condition of first value in group

I have this type of data in an ordered R dataframe. set.seed(25) date <- sort(as.Date(sample( as.numeric(as.Date("2019-01-01")): as.numeric(as.Date("2021-03-31")), 10, replace = T), origin =…
bolleke
  • 151
  • 8
1
2
3
20 21