Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
43918084
Creator II
Creator II

Creating formula for dimension

I have below sample data.  Blue fields are directly loaded from data source  of 2 different accounting period.  Some Deal number will exist in bother accounting period.  Some Deal number will exist in one of the accounting period.

I want to create a dimension "Status" to determine whether that deal number exist in both or just one of the accounting period.

The right hand side is my logic.  I am not sure how to create this dimension after data load, or if I should create it within the data script.

Hope I can have some guidance on this.

 

 

DataDataDataDataDatarequire formula/Script 
Deal numberTrad dateMaturity DateAcct DateAmtStatusLogic
1201803142023031620200831                         1,000existif maturity date > latest acct Date, status is exist
1201803142023031620200930                             500existif maturity date > latest acct Date, status is exist
2201803142020080520200831                               10Maturedif maturity date < latest acct Date, status is Matured
3202009022023031620200930                               20NewIf trade date > Latest acct date, status is New
1 Solution

Accepted Solutions
MayilVahanan

HI @43918084 

You can create a field in script 
Try like this

If(Trad Date > Acct Date, 'New',  if(Maturity Date > Acct Date, 'exist', 'Matured')) as Status

 

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

2 Replies
MayilVahanan

HI @43918084 

You can create a field in script 
Try like this

If(Trad Date > Acct Date, 'New',  if(Maturity Date > Acct Date, 'exist', 'Matured')) as Status

 

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
43918084
Creator II
Creator II
Author

Sorry, I also need to create a field to return 2 if the deal number exist in bother accounting period and 1 if exist in one of the period.

May I know how I can build it in the script  as the line are separated in 2 tables?

 

Thank you very much in advance again.