Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
How to do a division in a dataset of between rows
uptimeken
Dataset produces two rows
Row Name Value
1 diskReads 5
2 diskWrites 10
I want to bind a value called ratio to a chart
How do I in the "Select Data" For the chart use an expression for the Y Value of the series to produce a new value called diskRatio=row1/row2 ??
To complicate matters a given dataset can have way more than 2 rows
Row DiskName Name SampleTime
1 SDA1 DiskReads 1:00
2 SDA2 DiskWrites 1:00
3 SDA1 DiskReads 2:00
4 SDA2 DiskWrites 2:00
5 SDA1 DiskReads 3:00
6 SDA2 DiskWrites 3:00
So then the follow on question is, clearly I want the expression that can do the division to be for a given disk (DiskName) at a given sample time. (divide the Reads by the Writes at a single point in time for a disk).
I am also wondering how a denominator of 0 can be handled, but once I actually get the paradigm for creating this expression I guess I can figure that out easily.
Any help would be greatly appreciated.
Find more posts tagged with
Comments
mwilliams
Hi uptimeken,
Can you provide a small sample of what actual data would be and what you want it to look like with your "ratio" column? I'll try to reproduce it for you in a report design. Thanks.
Also include what version of BIRT you're using.
uptimeken
<blockquote class='ipsBlockquote' data-author="mwilliams"><p>Hi uptimeken,<br />
<br />
Can you provide a small sample of what actual data would be and what you want it to look like with your "ratio" column? I'll try to reproduce it for you in a report design. Thanks.<br />
<br />
Also include what version of BIRT you're using.</p></blockquote>
<br />
I'm using BIRT 2.5<br />
Data would look like the following<br />
Row,DiskName,Name,SampleTime,Value<br />
1,SDA1,DiskReads,1:00,5<br />
2,SDA1,DiskWrites,1:00,10<br />
3,SDA2,DiskReads,1:00,5<br />
4,SDA2,DiskWrites,1:00,20<br />
5,SDA1,DiskReads,2:00,10<br />
6,SDA1,DiskWrites,2:00,100<br />
7,SDA2,DiskReads,3:00,100<br />
8,SDA2,DiskWrites,3:00,100<br />
<br />
So for example for we would pair each time sample for reads/writes<br />
<br />
so row 1 and 2 for instance<br />
<br />
Row,DiskName,Name,SampleTime,CalculatedRatio<br />
1, SDA1, DiskRatio,1:00, 0.5 (5/10 - rows 1 and 2)<br />
2, SDA2, DiskRatio,1:00, 0.25 (5/20 - rows 3 and 4)<br />
3, SDA1, DiskRatio,1:00, 0.1 (10/100 - rows 5 and 6)<br />
<br />
And so on and so forth. Does this make more sense? Sorry for the errors in the first post regarding the data.<br />
<br />
Thank you very much for your help
mwilliams
uptimeken,
Here's one way to do it. Check out the attached report design. I used a couple computed columns and a visibility rule on the detail row. Let me know if you have questions. Be sure to change the file location of the .txt file to where you saved it in the dataSource editor.