SSRS expression problem for VS2012 Report viewer report IIF

I have a report that I am building in Visual Studio Reportviewer. I need for one of the texboxes in the matrix(table) to compare two fields. The two fields equal certian data then in that textbox show the value (data) of a third field. Below is an example of what I am talking about.
=IIF(Fields!EDU_MARKET.Value = "21" AND Fields!EDU_CLASS_NM.Value = "Sales University", Fields!STAFFCNT21.Value,
IIF(Fields!EDU_MARKET.Value = "22" AND Fields!EDU_CLASS_NM.Value = "Sales University", Fields!STAFFCNT22.Value,
IIF(Fields!EDU_MARKET.Value = "23" AND Fields!EDU_CLASS_NM.Value = "Sales University", Fields!STAFFCNT23.Value,
IIF(Fields!EDU_MARKET.Value = "24" AND Fields!EDU_CLASS_NM.Value = "Sales University", Fields!STAFFCNT24.Value, etc.....

So In this examplr if EDU_MARKET equals 21 and EDU_CLASS_NM equals Sales University then display/show the data in STAFFCNT21
then proceed to the nes IIF statement.
newjeep19Asked:
Who is Participating?
 
grendel777Commented:
Try the SWITCH function which can be easier to read than nested IIF's:
=SWITCH(
	Fields!EDU_MARKET.Value = "21" AND Fields!EDU_CLASS_NM.Value = "Sales University", Fields!STAFFCNT21.Value,
	Fields!EDU_MARKET.Value = "22" AND Fields!EDU_CLASS_NM.Value = "Sales University", Fields!STAFFCNT22.Value,
	Fields!EDU_MARKET.Value = "23" AND Fields!EDU_CLASS_NM.Value = "Sales University", Fields!STAFFCNT23.Value,
	Fields!EDU_MARKET.Value = "24" AND Fields!EDU_CLASS_NM.Value = "Sales University", Fields!STAFFCNT24.Value)

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.