5 Replies Latest reply on Aug 12, 2018 12:03 AM by Ankit Bansal

# Compare String Values

I have two calculations from which one is calculating current year accounts and second calculations is calculating previous year accounts, I want to know how many new accounts are added in current year:

Calculation 1 (Current Year)     Calculation 2(Previous Year)

ABC                                                  ABC

DEF                                                  DEF

GHI                                                  GHI

MNO

So output should be MNO account.

All the values are in string.

• ###### 1. Re: Compare String Values

Hello Nittin,

if im correct you want to compare calculation current year and previous year. and only print the calculation that only exist in the previous year?
if that correct you should make the calculation likes this.

IF  (Calculation 1 (Current Year) <> Calculation 2(Previous Year))

THEN Calculation 2(Previous Year)

END

the calculation will compare between current and previous year also if there's different between 2 current and previous it will print the previous year.

because from you data you say the output should be MNO which is MNO doesn't exist in the current year.

i hope this can help you and tell me if it not working or if i'm wrong.

Thank You,

Best Regards,

Welly Pratama.

• ###### 2. Re: Compare String Values

Thanks for your reply, but as the calculation 1 and 2 are calculating number of accounts so cannot compare one another, I tried creating set but not able to figure out how should I get the answer as combined set is not possible.

• ###### 3. Re: Compare String Values

In your case try to used PTD calculation for current year  and Previous year

Thanks

Best Regards

Hemraj Ashtankar

• ###### 4. Re: Compare String Values

For calculation 1 and 2 below are my calculations:

Calculations 1: IF DATEDIFF('year',[Month Id],[Latest Date]) = 0 AND  [Time Period] = 'Yearly' THEN [Account ID] end

Calculations 2: IF DATEDIFF('year',[Month Id],[Latest Date]) = 0 AND  [Time Period] = 'Yearly' THEN [Account ID] end

• ###### 5. Re: Compare String Values

Nitin,

Both of your calculations looks exactly same Can you attach the workbook or excel file with some sample data. That will be helpful.

Thanks,

Ankit Bansal