Pointer Properties expression SQL Server 2008R2/BIDS
There is probably a better way to do this but I need to capture all of these conditions, for example, if scope was .12 and costVariance was 0 and
ScheduleVariance .011 I would divide by 2 to get the average, or just use the Avg function for the two with values <>0. Or if all 3 had values >0 I would just add them and divide by three
and so on.
I am gettig the right results in the query i have pasted at the bottom of this post
Scope =0
CostVar=0
Schedulevariance=0 or
Scope >0
CostVar>0
Pjvariance<>0
The expression below work except for the section in bold, I could not get it to divide by or average.
Pointer Properties
=IIf(Fields!CostVariance.Value
= 0
and Fields!Scope_Value.Value
= 0,Fields!PjVariance.Value, IIf(Fields!CostVariance.Value
> 0
and Fields!Scope_Value.Value
> 0
and Fields!PjVariance.Value = 0, Fields!CostVariance.Value + Fields!Scope_Value.Value/2,IIf(Fields!CostVariance.Value
= 0
and Fields!Scope_Value.Value
> 0
and Fields!PjVariance.Value = 0,Fields!Scope_Value.Value, IIf(Fields!CostVariance.Value
> 0
and Fields!Scope_Value.Value
= 0
and Fields!PjVariance.Value = 0, Fields!CostVariance.Value,
+ Fields!CostVariance.Value + Fields!Scope_Value.Value/3))))
DataSet
SELECT MSP_EpmProject_UserView.ProjectName, MSP_EpmProject_UserView.[Project Schedule Variance %] / 100 AS 'PjVariance',
WSS_Content_fe62bd08e03143af8d1aed7e5fd7a337.dbo.UserData.nvarchar1 AS 'Scope State',
ISNULL(WSS_Content_fe62bd08e03143af8d1aed7e5fd7a337.dbo.UserData.float1, 0) AS 'CostVariance',
WSS_Content_fe62bd08e03143af8d1aed7e5fd7a337.dbo.UserData.nvarchar7 AS 'Project Name',
WSS_Content_fe62bd08e03143af8d1aed7e5fd7a337.dbo.UserData.nvarchar6 AS 'PjName',
WSS_Content_fe62bd08e03143af8d1aed7e5fd7a337.dbo.UserData.ntext2 AS 'Scope Statement', ISNULL(CONVERT(Float(1),
WSS_Content_fe62bd08e03143af8d1aed7e5fd7a337.dbo.UserData.sql_variant1), 0) AS 'Scope Value'
FROM MSP_EpmProject_UserView INNER JOIN
WSS_Content_fe62bd08e03143af8d1aed7e5fd7a337.dbo.UserData ON
MSP_EpmProject_UserView.ProjectName = WSS_Content_fe62bd08e03143af8d1aed7e5fd7a337.dbo.UserData.nvarchar7
WHERE (MSP_EpmProject_UserView.ProjectName = @ProjectName)
April 14th, 2011 4:42pm
Hi rixmcx59,
Could you please modify
Fields!CostVariance.Value + Fields!Scope_Value.Value/2 to (Fields!CostVariance.Value + Fields!Scope_Value.Value)/2
Then we could make sure summation will take effect firstly, then division calculation. Besides, I would recommend you make sure of SWITCH function in
reporting services if you have many options.
For more information about expression in reporting services, please see:
http://msdn.microsoft.com/en-us/library/ms157328.aspx
Thanks,
Challen Fu
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Free Windows Admin Tool Kit Click here and download it now
April 19th, 2011 2:13am
Thank you Challen, I will try Switch
April 19th, 2011 10:13am