Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi There,
I am having issues in getting the count statement
My expression is that count ({<NYEAR=mainyear>} distinct num) . When a filter is applied it work else it show 0 .
How can this be corrected. Please help .
regards
varghese
Hi
If mainyear is another field and you are trying to do row-by-row calculations, you cannot use a set expression, as the expression is evaluated once for the table/chart and not on every row.
You can do sum(if(NYEAR = mainyear, DISTINCT num)),
or
You can create a flag field in the load script:
LOAD ....
NYEAR,
mainyear,
If(NYEAR = mainyear, 1, 0) As YFlag,
....
and then use the flag in your expression:
Sum({<YFlag = {1}>} Distinct num)
HTH
Jonathan
Hi
If mainyear is another field and you are trying to do row-by-row calculations, you cannot use a set expression, as the expression is evaluated once for the table/chart and not on every row.
You can do sum(if(NYEAR = mainyear, DISTINCT num)),
or
You can create a flag field in the load script:
LOAD ....
NYEAR,
mainyear,
If(NYEAR = mainyear, 1, 0) As YFlag,
....
and then use the flag in your expression:
Sum({<YFlag = {1}>} Distinct num)
HTH
Jonathan
Dear Jonathan
Thanks , It worked.
regards
Varghese
count (distinct {<NYEAR={'mainyear'}>} num)