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 Using Multi Parameter

Author  Topic 

ZMike
Posting Yak Master

110 Posts

Posted - 2012-08-07 : 09:36:13
I have a drop down box that is a multiparameter.

Basically the code I have is this

= IIF(Parameters!FunctionalArea.Label ="ISD",
Sum(Fields!WeekendHolidayHours.Value, "DataSet1") - Sum(Fields!WeekendHolidayHours.Value, "ISD") ,
Sum(Fields!WeekendHolidayHours.Value, "DataSet1"))

I also tried to join the parameter to find the value.

So basically if the value "ISD" is chosen then I want to subtract 2 sums. If it's not I only need 1 sum.

ZMike
Posting Yak Master

110 Posts

Posted - 2012-08-07 : 09:44:48
Well this isn't exactly what I was looking for but this does the job for now

= IIF(Sum(Fields!WeekendHolidayHours.Value, "ISD") >0,
Sum(Fields!WeekendHolidayHours.Value, "DataSet1") - Sum(Fields!WeekendHolidayHours.Value, "ISD") ,
Sum(Fields!WeekendHolidayHours.Value, "DataSet1"))


However is anyone knows the answer to my original problem I'd still like to add that to my tips for future reference
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-08-07 : 10:04:52
you can use like this

IIF(Sum(IIF(Fields!WeekendHolidayHours.Value="ISD",1,0)) >0,...

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

Go to Top of Page

ZMike
Posting Yak Master

110 Posts

Posted - 2012-08-09 : 11:42:14
visakh16,

I had issues making that work. Although this question is along the same lines.


I have a report that's broken out like this

Group by Year
Group by Month
Department and Data

Under each Month I have a total which is working just fine.

However they want to totals.
The full total (Which I have) and then the Total Minus a department (or more)

If I do
=iif(Fields!FunctionalArea.Value="ISD", Fields!TTLHours.Value,0)

It always returns 0 Since the report doesnt really have a group by on the department. Is there a way to look up the data for the specific deparment and then subtract it for the total ?


If I make a seperate dataset I could subtract the departments but since I cant group by the different datasets on the same tablix (that I can find) that really work work since it pulls in the entire total (all Months instead of grouping by month.)


Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-08-09 : 12:07:51
you can do like

=SUM(Fields!TTLHours.value,"your month group name") - Fields!TTLHours.value

in textbox at department level to get total - depthour value

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

Go to Top of Page
   

- Advertisement -