Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
apoorvasd
Creator II
Creator II

Calculated expression in the script

Hi All,

I have three fields say, A, B and C (where C is an account number). All these three fields contain numeric values(all of these have same number of digits). Now I need to calculate the "Amount" using these three fields which should satisfy the following conditions:

1. Calculate the amount when first 4 digits of A and B are not equal, for so and so account numbers

2. Calculate the amount for rest of the account numbers, independent of the condition that is specified in 1 (i.e. "first 4 digits of A and B not equal" should not be applied).

How do I write an expression or a where clause which satisfies both the conditions mentioned above for calculating the "Amount"?

Any suggestions on this?

Thank you.

4 Replies
sunny_talwar

Would you be able to provide 4-5 lines of input data with the expectation of the output?

Anil_Babu_Samineni

1) Perhaps This

Aggr(If([Account number] <> left([Account number],4)),Sum(amount))

i didn't understand your 2nd Question.

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
apoorvasd
Creator II
Creator II
Author

Hello,

Thanks for the suggestion.

1st condition should be applied only for specific account numbers and the 2nd condition should be applied for rest of the account numbers (i.e. it shouldn't consider the values of fields A and B). Let me know if this is clear.

apoorvasd
Creator II
Creator II
Author

Hello,

Sorry i can just tell that fields, A, B and C (Account Number) all have 10 digit numeric values.

Like,   A = 0005003000, 0005003999 etc

          B = 0005008899, 0005002291 etc 

          Account Number = 0004300910, 0004300920 etc