Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Analysis Server and Reporting Services (2008)
 IIF Statement Help

Author  Topic 

ggarza75
Yak Posting Veteran

50 Posts

Posted - 2010-08-24 : 18:10:52
I'm stuck on how to write an IIF statement.

I have a set of Service Codes in a table. Service Codes 1-49 means "Billable", codes 50-89 means "Non-Billable" and codes 90-99 means "Other Codes"

I have my report format ready. However, I want a header for each of the three groups. So when codes 1-49 are displayed, a header above code 1 should read "Billable". And then so on with the other two titles.

Hope my explaination was clear.

Thanks for any help.

robvolk
Most Valuable Yak

15732 Posts

Posted - 2010-08-24 : 18:13:21
Can you just JOIN to that table in your data source query and include that column in the output, then group on it?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-08-25 : 10:10:12
you can use Switch statement in ssrs for that.but as suggested you need to bring it in query first by means of join

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

ggarza75
Yak Posting Veteran

50 Posts

Posted - 2010-08-26 : 16:44:15
So I've used the SWITCH statement for codes under the number "50". Now is there a syntax to get codes between a certain range, for example, codes 51 thru 60?
To get the header for codes 1 thru 49, I typed, =SWITCH(Fields!Codes.Value > 50, "Billable Codes"). That worked great, so I'm good there.
Go to Top of Page

pizzazzz
Yak Posting Veteran

55 Posts

Posted - 2010-09-07 : 18:18:11
IIf([Service Codes] Between 1 And 49,"Billable",IIf([Service Codes] Between 50 And 89,"Non-Billable","Other Codes"))
Go to Top of Page

muetze
Starting Member

2 Posts

Posted - 2010-09-08 : 04:19:33
Use Case maybe?
Go to Top of Page

pizzazzz
Yak Posting Veteran

55 Posts

Posted - 2010-09-08 : 12:59:29
in sql IIF is not recognizable - Yes, use "CASE" in SQL - but this person asked about nested IIF statement...
Go to Top of Page
   

- Advertisement -