Forum Discussion

Cosimo's avatar
Cosimo
Contributor II
3 years ago

Studio Report - calculating % at Group band level

SOURCE: ONESTREAM CHAMPIONS

Champions,
Is there a way to have a Studio report recalculate a value at a group summary level instead of having the report sum up values from the detailed band?

In example below, the ROI% as the 401 Total line is displaying 4.7% which is the summed up total of % from detail records. This value should instead be recalculated as Total Net ROI / Total Revenue = 510,000 / 15,000,000 = 3.14%

In Studio, Is there a way to define a calculated field that uses data from other fields on the same band i.e. the group total Net ROI and Total Revenue?

 

image
image.png1046×396 8.73 KB
  • Cosimo's avatar
    Cosimo
    Contributor II

    Small correction: Total Net ROI / Total Revenue = 510,000 / 15,000,000 = 3.4% and not 3.14%

    • I guess this is where scripts can come in handy. However, there is no documentation whatsoever on how to write them.
      Here is something you can try
      Remove the Summary on that label, add a script on the before print event.

      Imaging that 4.7 is called as label47, 510000 is called as label45, and 15,000,000 is called as label46
      Then this will give you what you are looking for.

      Private Sub label47_BeforePrint(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintEventArgs)
      dim decRevValue as decimal = Decimal.Parse(me.label46.Summary.GetResult())
      dim decROIValue as decimal = Decimal.Parse(me.label45.Summary.GetResult())
      
      me.label47.text = decROIValue/decRevValue
      End Sub
      • Cosimo's avatar
        Cosimo
        Contributor II

        Thanks KING!

        At first I was getting an error where the code was not recognizing GetResults() function but after adding a few DevExpress Imports, it works!

         

        image
         

         

         

        image