Nested iif with multiple SSRS conditions

I need to write a formula for an SSRS report. I'm not sure about the exact syntax, but I think it should be a nested iif, but with several criteria, checking the meaning of the diagram and division fields. At the end of the day, if the chart = 110300 and the division = 100, then "AP Intercompany - USA" or if the chart = 110300 and division = 200, then "AP - RUS Intercompany" is different, then simply display the chart name. Something like this, but actually spelled correctly.

iif Fields!chart.Value="110300" and Fields!division.Value="100" then Fields!chartname.Value="Intercompany AP - USA" if Fields!chart.Value="110300" and Fields!division.Value="200" then Fields!chartname.Value= "Intercompany AP - RUS" else Fields!chartname.Value 

I really appreciate any help with this!

+7
source share
1 answer

You pretty much decided it yourself! To write this to T-SQL, right-click on the chart name and change its value to the following expression:

 IIF(Fields!chart.Value="110300" AND Fields!division.Value="100","Intercompany AP - USA",IIF(Fields!chart.Value="110300" AND Fields!division.Value="200","Intercompany AP - RUS","Default Chart Name") 

See here for an explanation of how the IIF function works.

From the link you can see that it takes the following format, where commas are used instead of “Then” or “Else”:

IIF ( boolean_expression, true_value, false_value )

So, to break the expression:

 IIF(Fields!chart.Value="110300" AND Fields!division.Value="100", "Intercompany AP - USA", IIF(Fields!chart.Value="110300" AND Fields!division.Value="200", "Intercompany AP - RUS", "Default Chart Name" ) ) 
+14
source

All Articles