SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 Trying to setup Matrix like Excel Pivot Table
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

jackkaye
Starting Member

USA
7 Posts

Posted - 11/12/2013 :  11:48:57  Show Profile  Reply with Quote
I have an Excel Pivot table that has a Calculated Expression to determine how accurate a person is with their Opportunity Revenue vs. te Actual Revenue. I would like to create the same Calculated Expression in the Matrix but I'm not having much success.

Here is the Calculated Expression from the Excel Pivot Table:

=IF(AND(OppRevenue=0,NavRevenue=0),0,IF(OppRevenue>ABS(NavRevenue),ABS(NavRevenue)/OppRevenue,OppRevenue/ABS(NavRevenue)))

Here is what I created in SQL Reports for the Expression field:
=IIF(((Fields!NavRevenue.Value=0) And (Fields!OppRevenue.Value=0)),0,IIF(Fields!OppRevenue.Value>ABS(Fields!NavRevenue.Value),ABS(Fields!NavRevenue.Value)/Fields!OppRevenue.Value,Fields!OppRevenue.Value/ABS(Fields!NavRevenue.Value)))

I keep getting a #Error back in the field results. Any ideas?

visakh16
Very Important crosS Applying yaK Herder

India
52309 Posts

Posted - 11/12/2013 :  12:47:02  Show Profile  Reply with Quote
=IIF(((Fields!NavRevenue.Value=0) Or (Fields!OppRevenue.Value=0)),0,IIF(Fields!NavRevenue.Value=0) Or (Fields!OppRevenue.Value=0),0,IIF(Fields!OppRevenue.Value>ABS(Fields!NavRevenue.Value),ABS(Fields!NavRevenue.Value)/Fields!OppRevenue.Value,Fields!OppRevenue.Value/ABS(Fields!NavRevenue.Value))))

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

jackkaye
Starting Member

USA
7 Posts

Posted - 11/12/2013 :  13:07:59  Show Profile  Reply with Quote
You were missing a comma but I added that and the report ran. However, I'm still receiving a #error message.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52309 Posts

Posted - 11/12/2013 :  13:09:57  Show Profile  Reply with Quote
whats the datatype of NavRevenue and OppRevenue?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

jackkaye
Starting Member

USA
7 Posts

Posted - 11/12/2013 :  13:13:04  Show Profile  Reply with Quote
In the Dataset SQL query they both are defined as decimal.
Go to Top of Page

jackkaye
Starting Member

USA
7 Posts

Posted - 11/13/2013 :  09:27:47  Show Profile  Reply with Quote
Any other thoughts on how to resolve the #error message for this expression field?
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000