Studio Report - calculating % at Group band level

Cosimo
Contributor II

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
5 REPLIES 5

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

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
 

Glad it worked. I’m surprised I didn’t import those DevExpress ones. Maybe it is 6.5 and I’ve everything on one machine.

I still like using Studio rather than the embedded Report Designer within the Windows app.

In any case, thanks again for the code example. Wish someone gave a thorough course on advanced OneStream Studio development.