Hi @weird_guy,
Would you be able to elaborate a bit further on what you are trying to do or let me know if Iâm headed in the right direction..
So essentially, for a given payment_method, youâd like to run the sum of âcapturedâ amounts (for âvisaâ for example), divided by the sum of âcapturedâ (for visa)+âdeclinedâ (for visa)?
Additional questions:
Will the user have an option of selecting the payment method so it will vary based on selection?
When you ask how to transfer âstate_toâ to âConvert to EURâ, what are you trying to do with this and how would you like âConvert to EURâ to come into affect?
So yes, Id like to run the sum of âcapturedâ amounts, divided by the sum of âcapturedâ +âdeclinedâ and convert it to percent
F.e., we have âcapturedâ 150, âdeclinedâ 70. total 220.
150/220 = 0.68
in percent it is 68%
Will the user have an option of selecting the payment method so it will vary based on selection? - No, it happened. Just the finished data already with the completed purchases
When you ask how to transfer âstate_toâ to âConvert to EURâ, what are you trying to do with this and how would you like âConvert to EURâ to come into affect? - here I want to check how many funds are lost (DECLINED) / successful (CAPTURED ) in EUR.
Aha, I got it. Actually I have additional field for each transactions âamountâ and âorder_idâ
So the formula is âstatus_toâ + âorder_idâ (how many CAPTURED/DECLINED trx) * âamountâ
Then * âConvert to EURâ (because I have another filed âcurrencyâ . There are a lot of different currencies)
Hi @weird_guy,
In reference to the QS language, unfortunately thereâs no documentation that breaks down the error codes you may receive (in my opinion, the error messages could use some updating to help users diagnose the issue better!). In terms of help for learning more about how to better build and utilize the advantages of calculated fields, this is the best article Iâve found for furthering that knowledge!
Looking at your calculation; what is the field type for âorder_idâ, is it a string? If so, I believe thatâs where your error is coming in as youâre unable to sum string values. Do you have an additional field in your dataset that contains the amounts youâre trying to sum or are you trying to get gather a count of order idâs?
If trying to utilize a count of order idâs in the calculation, youâll half to first build out a separate calc. field to complete that; which in that case, I would check out the DistinctCountOver function.
Thank you for your understanding. Iâm just new to QS.
I just changed {sales} to {order_id}
In my example, order_id refers to transaction ID - and each order_id has a status of âCAPTUREDâ or âDECLINEDâ.
So Iâm trying to calculate the approval percentage for each {payment method}.
For example:
A company has had 100 VISA card orders in the last 2 hours.
50 captured/ 50 declined= AR% is 50%.
OR
IF {payment method} = âVISAâ THEN âApprovalRateâ = {CAPTURED} {order_id} / {CAPTURED} {order_id} +{DECLINED} {order_id} *100%