Calculated fields
Answered
Hi there - I have a question:
I am trying to add and then divide, but running into problems. For example:
Field1 + Field 2 + Field 3 / 25 * 100 isn't working. I have tried parenthesis, too:
((Field1 + Field 2 + Field3 ) / 25) * 100
I have tried other combinations. Any ideas?
Thank you.
Hi Hugo,
Thanks for reaching out.
Assuming your fields are aggregated in the report itself, you have to specify the aggregation in the Calculated Field itself in order for those values to be considered:
I have three SUM aggregation fields in my report:
If I simply do Field 1 + Field 2 + Field 3 / 25 * 100, or any combination thereof, it won't be the correct value in the Calculated Field. You need to specify the aggregation on each field. This would be the SQL statement to achieve the correct value of 2,087,381,859:
Note also that some RDBMS recognize non-decimal numerical values as integers and not floats, so you may need to put '/ 25.0 * 100.0' instead.
Please give this a try and let me know if this answers your question.
Regards,
Mike
Hi Hugo,
Thanks for reaching out.
Assuming your fields are aggregated in the report itself, you have to specify the aggregation in the Calculated Field itself in order for those values to be considered:
I have three SUM aggregation fields in my report:
If I simply do Field 1 + Field 2 + Field 3 / 25 * 100, or any combination thereof, it won't be the correct value in the Calculated Field. You need to specify the aggregation on each field. This would be the SQL statement to achieve the correct value of 2,087,381,859:
Note also that some RDBMS recognize non-decimal numerical values as integers and not floats, so you may need to put '/ 25.0 * 100.0' instead.
Please give this a try and let me know if this answers your question.
Regards,
Mike
Got it--helpful, yes!
Thank you.
Got it--helpful, yes!
Thank you.
Hi Hugo,
Great! I'll go ahead and mark this as Answered then, but please don't hesitate to reach out with any further questions or concerns on this or anything else.
Regards,
Mike
Hi Hugo,
Great! I'll go ahead and mark this as Answered then, but please don't hesitate to reach out with any further questions or concerns on this or anything else.
Regards,
Mike
Replies have been locked on this page!