Calculated fields

Hugo Mendoza shared this question 8 months ago
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.

Comments (3)

photo
1

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:

/n+9O1lVrMooNQAAAABJRU5ErkJggg==

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:

/J1BqUBQEEEEAAAQQQQAABBGImQPATM1oSRgABBBBAAAEEEEAAgWQSIPhJptagLAgggAACCCCAAAIIIBAzAYKfmNGSMAIIIIAAAggggAACCCSTwP8PmEXVHz0ehAkAAAAASUVORK5CYII=

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

photo
1

Got it--helpful, yes!

Thank you.

photo
1

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