Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Finding difference in dates , group by another column

sriniprad08
11 - Bolide

Hi Team,

 

I have situation where we have to difference between two dates group by id column. The results should be another column interms of dates,

The questions are 1) and 2)

 

Please let me know your thoughts.

sriniprad08_0-1603955482957.png

 

idstart dateend date
366312/13/200212/30/2021
36631/15/200312/20/2002
12344/8/200312/31/2003
12347/2/200312/31/2020
12348/6/20039/30/2003
36638/6/20039/30/2004
21438/6/20031/30/2004
21428/6/20032/27/2004

Thanks,

Sriniv

10 REPLIES 10
atcodedog05
22 - Nova
22 - Nova

@sriniprad08 

 

Great scenario do have any expected output. The logic is only partially clear😅

Qiu
20 - Arcturus
20 - Arcturus

@sriniprad08 
Maybe a bit off on the details but should give the idea1029-sriniprad08.PNG

sriniprad08
11 - Bolide

Thank you @atcodedog05 

Please find below the potential output.

 

Scenario A - Ouptut  Scenairo B - output
idNo of months/days idNo of days/mnths
366323  366323
123422  123425
2143300  214322
214220  213521

 

Scenario A- The logic is try to get the difference of two dates by the id.

Scenario B - This is little different. Wherein we take the max of column B  and take the difference from column C again group by id.

 

The idea is to see which ids are greater than certain threshold interms of no of days or months.

Thanks

sriniprad08
11 - Bolide

Hi @Qiu,

 

Thank you for the solution. it looks good. One thing sorry i missed was i need max of start date for that particular id not for the entire column. how can i go about this?

 

Actually it should take the max of start date column for that particular id and subtract with the current date not the end date.

 

cheers,

Srinivas

atcodedog05
22 - Nova
22 - Nova

Hi @sriniprad08 

 

If your dates and expected output the right numbers or just random numbers.

 

Because for your first row

 

12/13/2002 - 12/30/2021 cannot be 23 months it will be more than that

 

and 

 

1/15/2003 - 12/20/2002 duration is 26 days.

Qiu
20 - Arcturus
20 - Arcturus

@sriniprad08 
Add ID to the sorting and sample the fist by grouping of ID should do it.1029-sriniprad08-1.PNG

sriniprad08
11 - Bolide

@atcodedog05 

 

They are random numbers . I provided it as a sample.

 

Thanks,

sriniprad08
11 - Bolide

Thank you @Qiu  for your help.

I will come back if i face anything in real data.

 

Cheers,

Sriniv

atcodedog05
22 - Nova
22 - Nova

Cool anyways 

Glad its solved 🙂

 

Kudos to you @Qiu 

 

Labels