mysql - Birt report - count the number of times it matches a criteria -


╔═══╦════════════╦═════════════╗ ║id ║ tv#        ║ time        ║ ╠═══╬════════════╬═════════════╣ ║ 1 ║ tv1        ║ 0           ║ ║ 2 ║ tv2        ║ 10          ║ ║ 3 ║ tv3        ║ 0           ║ ║ 4 ║ tv3        ║ 20          ║ ║ 5 ║ tv3        ║ 21          ║ ║...║ ...        ║ ...         ║ ╚═══╩════════════╩═════════════╝ 

i want count number of elements id, each tv#, time > 0. in case, want result be:

tv1 - 0 ; tv2 - 1; tv3 - 2

i'm using birt report, , i've tried different ways this, couldnt want.

i've tried different ways, i'm using @ moment:

data cube, summary fields (measure)

function: count

expression: measure["id"]

filter: measure["time"]>0

and i'm using aggregation builder:

function:count or sum

expression:measure["id"]

filter: measure["time"]>0

aggregate on: grouptv#

when use count, returning: 0s , 1s (it gives me "1" tv# when there @ least 1 time>0), ie tv1 - 0 ; tv2 - 1; tv3 - 1

when use sum, returning: number of times each tv# appears on table (when there @ least 1 time>0 channel), ie tv1 - no output ; tv2 - 1; tv3 - 3

can me?

e.g.:

select tv      , sum(case when time > 0 1 else 0 end) x    my_table   group      tv; 

Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -