Approval Rate/Amount calculated field

Hi @weird_guy,
So since you need to run off a count of your order id’s, why don’t we try this instead:

DistinctCountOver(ifelse({state_to} = ‘CAPTURED’, {sales}, NULL), [{payment_method}], PRE_AGG)/
DistinctCountOver(ifelse({state_to} = ‘CAPTURED’ OR {state_to} = ‘DECLINED’, {sales}, NULL), [{payment_method}], PRE_AGG)

Since you’re trying to gather a count of a field that’ s a string, you’ll need to incorporate a calculation that provides you with a count, like distinctCountOver.
Additionally, please check out this article as it explores the order of operations when building calculated fields and can be very valuable in helping out further.