Need to be able to calculate the total of column data in order to be used in reporting metrics

For the following table of records, I need to be able to calculate the total of the highlighted columns, (Bid Amount & Principle Balance) so that I can utilize that information to create a list of metrics listed below the Picture.

  • Balance Underwritten
    • Sum of Principle Balance
  • Balance Bid
    • Sum of Principal Balance (Where Bid Submitted? = Yes)
  • Balance Won
    • Sum of Principal Balance (where Bid Won? = Yes)
  • Bid to Underwritten %
    • Balance Bid divided by Balance Underwritten
  • Win to Bid %
    • Balance Won divided by Balance Bid
  • Win to Underwritten %
    • Balance Won divided by Balance Underwritten

  Discussion posts and replies are publicly visible

Parents Reply
  • +1
    Certified Lead Developer
    in reply to cls5469
    this following query which that kind of gives me the result I want

    1) store the result of that query in a local variable

    2) call sum() on that result (or the relevant field)

    First you need to know how to access the field in RecordType data post querying.  Kinda-stupidly, this requires referencing the entire recordtype and then the relevant fieldname.  For the recordtype here in my example I have a field name called "dataLength". (Querying just a page of 10 only for simplicity's sake).

    So let's display the full value first:

    Traditional queries would let us just add ".dataLength" after that to get the property alone as a list.  Let's try:

    (Womp, womp...)

    So how do we access it?  Following the error message, we add the record type property reference in square brackets:

    Voila!

    Then for the cherry on top, since now we just have an array of integers, we can pass that quite cleanly into sum().

    Though I often prefer to abstract the individual steps into their own local variables, which adds a bit more flexibility...

    And as with most things, when crafting expressions it's best to start with something small and working, and then iterate it step-by-step.

Children