Forum Replies Created

Viewing 13 posts - 1 through 13 (of 13 total)

  • Reply To: Fill missing rows in dataset

    @jeff Any update on above ?

  • Reply To: Fill missing rows in dataset

    Jeff Moden wrote:

    So, just to be sure, "Component N" and "Region" can actually be anything, correct?  And the goal is to assign the "N" of "Group N"?  Do the requirements of...

  • Reply To: Fill missing rows in dataset

    Jeff Moden wrote:

    Ombir wrote:

    Let me give more context on this. I am trying to identify if multiple components have been purchased by customers (Sales>0) in Last 4 quarters and then on...

    • This reply was modified 2 years, 5 months ago by  Ombir.
  • Reply To: Fill missing rows in dataset

    Let me give more context on this. I am trying to identify if multiple components have been purchased by customers (Sales>0) in Last 4 quarters and then on basis of...

  • Reply To: Fill missing rows in dataset

    Jeff Moden wrote:

    @Ombir ,

    I know that the Fill_Gaps table is just a test table here.  What value is returned when you run the following code against the real table?

                

    May 28, 2022 at 2:52 am

    #4040547

  • Reply To: Fill missing rows in dataset

    Thanks Scott. I will check this out.

  • RE: Aggregate Data for the Last Day of the Month

    I am getting the same output with this query

    Select convert(date,saledate),sum(saleprice) from Data.SalesbyCountry
    where convert(date,saledate) = eomonth(saledate) and year(saledate)='2016'
    group by convert(date,saledate)

    Am I missing something...

  • RE: Apply Pivot in SQL Server

    Well, you need to be changing your PromotionRowID logic as well, Other wise your whouldn't be having the same result. Let say you have another ChargeCode 'SLA' which comes under...

  • RE: Apply Pivot in SQL Server

    The Select statement in the APPLY clause doesn't include a FROM clause because it's referencing a column from previous tables (in this case DtlChrg) and making computations on the columns...

  • RE: Apply Pivot in SQL Server

    Hi Twin Devil,

    I have already completed these stairways and apply operator basics. Now I'm focusing on practical part and I know the best way to learn is solve problems that...

  • RE: Apply Pivot in SQL Server

    User7766 (8/10/2016)


    twin.devil (8/10/2016)


    SELECT

    PromotionInd

    , ISNULL(MAX(case when vChargeCode = 'BRK' then vChargeCode end),0) AS BrkChargeCode

    , ISNULL(SUM(case when vChargeCode = 'BRK' then [ChrgAmt] end),0) AS BrkAmount

    , ISNULL(MAX(case when vChargeCode = 'CLR'...

  • RE: CASE statement

    Try this:

    Select

    t2.ID1,

    t2.startdate as taskstartdate,

    case

    when t2.enddate < getdate() then max(t1.Cumulative)

    when t2.StartDate > getdate() then 0

    when getdate() < t2.enddate and getdate() > t2.StartDate

    then (Select max(t3.Cumulative) from #Table1 as t3...

  • RE: CASE statement

    Try this for table1 and table2 :

    Select

    t2.ID1,

    t2.startdate as taskstartdate,

    case

    when t2.enddate < getdate() then max(t1.Cumulative)

    when t2.StartDate > getdate() then 0

    when getdate() < t2.enddate and getdate() > t2.StartDate

    then (Select...

Viewing 13 posts - 1 through 13 (of 13 total)