General Discussions

Discuss any topics that are not product-specific here.
SOLVED

Generate Date based on different date columns as condition

zzhangs
5 - Atom

Hello Community, 

 

I am a beginner here, and currently working a something that I am having hard time with, I hope I can get some help here, Appreciate it! 

 

here is the data I am working with: 

 

1. the report is pulled every quarter end, the ReportQuarterDate = Quarter End date we pull the data 

2. the logic is: 

  • if there is an announced date for the company, return the quarter end that the announced date occurred in
  • if there is no announced date for the company, leverage the closed date and return the quarter end that the closed date occurred in
  • if the company has both announced and closed date, only take the announced date.

Thanks to anyone who are helping! 

 

Company NameEvenDateEvent StatusStore_AnnouncedDateStore_ClosedDateReportQuarterDate
A2021-03-15ANNOUNCED2021-03-15 2019-09-30
A2021-04-28CLOSED 2021-04-282019-09-30
A2021-03-15ANNOUNCED2021-03-15 2019-12-31
A2021-04-28CLOSED 2021-04-282019-12-31
A2021-03-15ANNOUNCED2021-03-15 2020-03-31
A2021-04-28CLOSED 2021-04-282020-03-31
A2021-03-15ANNOUNCED2021-03-15 2020-06-30
A2021-04-28CLOSED 2021-04-282020-06-30
A2021-03-15ANNOUNCED2021-03-15 2020-09-30
A2021-04-28CLOSED 2021-04-282020-09-30
A2021-03-15ANNOUNCED2021-03-15 2020-12-31
A2021-04-28CLOSED 2021-04-282020-12-31
A2021-03-15ANNOUNCED2021-03-15 2021-03-31
A2021-04-28CLOSED 2021-04-282021-03-31
B2021-12-06ANNOUNCED2021-12-06 2020-03-31
B2021-12-06ANNOUNCED2021-12-06 2021-06-30
B2021-12-06ANNOUNCED2021-12-06 2021-09-30
B2021-12-06ANNOUNCED2021-12-06 2021-12-31
B2021-12-06ANNOUNCED2021-12-06 2022-03-31
B2021-12-06ANNOUNCED2021-12-06 2022-06-30
C2020-03-06CLOSED 2020-03-062020-03-31
C2020-03-06CLOSED 2020-03-062020-09-30
C2020-03-06CLOSED 2020-03-062019-12-31
C2020-03-06CLOSED 2020-03-062021-12-31

 

 

  • Desired result 
Company NameEvenDateEvent StatusStore_AnnouncedDateStore_ClosedDateReportQuarterDateEventQuarterDate
A2021-03-15ANNOUNCED2021-03-15 2019-03-312021-03-31
B2021-12-06ANNOUNCED2021-12-06 2021-12-312021-12-31
C2020-03-06CLOSED 2020-03-062020-03-312020-03-31
1 REPLY 1
caltang
17 - Castor
17 - Castor

Like this?

 

Screenshot 2023-06-27 114202.png

Calvin Tang
Alteryx ACE
https://www.linkedin.com/in/calvintangkw/
Labels