Home » Archived » BIRT » Birt report - COUNTIF - count the number of times it matches a criteria
Birt report - COUNTIF - count the number of times it matches a criteria [message #1740110] |
Tue, 09 August 2016 11:24 |
Diogo Santos Messages: 4 Registered: August 2016 |
Junior Member |
|
|
╔══╦══╦═══╗
║id.║TV#║Time║
╠══╬══╬═══╣
║01║TV1║ 00 ║
║02║TV2║ 10 ║
║03║TV3║ 00 ║
║04║TV3║ 20 ║
║05║TV3║ 21 ║
║ ... ║ .... ║ ... ║
╚══╩══╩══╝
Hi, I'm new to Birt, maybe this is too numb but:
I want to count the number of elements id, for each TV#, which time > 0. In this case, I want the result to be:
TV1 - 0 ; TV2 - 1; TV3 - 2
I'm using BIRT Report, and I've tried different ways to get this, but I couldnt get what I want.
I've tried different ways, this is what I'm using at the moment:
Data Cube, Summary fields (measure)
Function: Count
Expression: measure["id"]
Filter: measure["Time"]>0
And then I'm using an Aggregation Builder:
Function:Count or Sum
Expression:measure["id"]
Filter: measure["Time"]>0
Aggregate on: GroupTV#
When I use count, this is returning: only 0s and 1s (it gives me "1" to TV# when there is at least one Time>0), ie TV1 - 0 ; TV2 - 1; TV3 - 1
When I use sum, this is returning: the number of times each TV# appears on the table (when there is at least one Time>0 for that channel), ie TV1 - no output ; TV2 - 1; TV3 - 3
I want something like COUNTIF
Can someone help me?
[Updated on: Wed, 10 August 2016 16:36] Report message to a moderator
|
|
|
Re: Birt report - count the number of times it matches a criteria [message #1740207 is a reply to message #1740110] |
Wed, 10 August 2016 12:56 |
Lucas Kaltenbrunner Messages: 2 Registered: August 2016 Location: Austria |
Junior Member |
|
|
Sorry I´m also new to BIRT but I hope i can help you a little bit.
Example:
I used a Flat File Data Source (.csv) with the following Data:
ID,TV#,Time
01,TV1,0
02,TV1,0
03,TV2,0
04,TV2,1
05,TV2,1
06,TV2,1
07,TV3,0
08,TV3,0
09,TV3,0
10,TV3,3
11,TV3,3
IN BIRT:
Aggregation Builder:
Data Type: Integer
Function: Count
Expression:
Filter: dataSetRow["Time"] >0 && dataSetRow["TV#"] == "TV1"
Result: 0
Filter: dataSetRow["Time"] >0 && dataSetRow["TV#"] == "TV2"
Result: 3
Filter: dataSetRow["Time"] >0 && dataSetRow["TV#"] == "TV3"
Result: 2
That´s all i got in 1 Minute because i have to go.
Hope it helped at least a little bit.
|
|
| | |
Goto Forum:
Current Time: Fri Mar 29 07:03:14 GMT 2024
Powered by FUDForum. Page generated in 0.02335 seconds
|