Home > SSRS Expert > SSRS #37 – How to use IIF function to conditionally count unique values correctly‏

SSRS #37 – How to use IIF function to conditionally count unique values correctly‏

This should be a simple task. But I struggled with it longer than I really should have.

Goal

Count unique number of FTEs only when the flag FTE is 1.

It turned out that all I need to do is to put the IIF function inside the COUNTDISITNCT function.

CountDistinct(IIF(Fields!FTE.Value = 1, Fields!UW_NM.Value,Nothing))

But I started in the wrong direction. I put the CountDistinct function inside the IIF function.

IIF(Fields!FTE.Value = 1, CountDistinct(Fields!UW_NM.Value), Nothing)

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: