In an SSRS report builder expression, I am trying to get the sum of a conditional count -


i want sum of count if count >=3. gives me sum of counts, regardless if <> 3:

=sum(iif(countdistinct(fields!encounter.value)>=3,1,0))

this produces th same result, total number of distinct encounters:

=sum(iif(countdistinct(fields!encounter.value)>=3,countdistinct(fields!encounter.value),nothing))

i want total number of distinct encounters if there 3 or more per person. grouping on person first, encounter id.

ex: person enc john 1 bob 4 sue 2 ann 3

total enc>=3: 2

based on requirement, if there not details rows under encounter, should directly compare fields!encounter.value instead of using countdistinct()

sum(iif(fields!encounter.value>=3,1,0))

if have multiple detail rows under encounter group level, requirement can't achieved because can't use aggregation function within aggregation function. means can't distinct encounter ids first, calculate total.


Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -