Solved

How do I create a formula column that will subtract two generated colums, from column grouping?

Posted on 2014-12-12
10
202 Views
Last Modified: 2014-12-23
I have a Matrix with a column grouping.
when running the report it creates two columns.
Column A     Column B

I need:

Column A     Column B      =Column A - Column B

I need to subtract Column B  from Column A somehow by referencing

I am having a problem with the formula where it only shows column A in the formula colum.

Please advise!!
0
Comment
Question by:rhservan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
10 Comments
 
LVL 24

Expert Comment

by:Phillip Burton
ID: 40497890
Not enough information, for example,what is your data source and data set?
0
 

Author Comment

by:rhservan
ID: 40509005
Hope this helps!
Variance.rtf
0
 
LVL 24

Expert Comment

by:Phillip Burton
ID: 40509092
Are you saying that there is a varchar field called ACTUAL_BUDGET, which says "Actual" or "Budget", and there is a money field called SIGNEDDATA?
0
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 

Author Comment

by:rhservan
ID: 40509226
Yes, Actual and budget is in a Category dimension which compares Actual dollars spent to Budget Dollars spent based on the money measure signeddata.
0
 
LVL 24

Assisted Solution

by:Phillip Burton
Phillip Burton earned 500 total points
ID: 40509286
Try this;

=sum(IIf([ACTUAL_BUDGET])="Actual",SIGNEDDATA,0)-sum(IIf([ACTUAL_BUDGET])="Budget",SIGNEDDATA,0)
0
 

Author Comment

by:rhservan
ID: 40511554
I crated a column inside the group and placed  formula in there.  When I ran the report it eroded with a scope problem.
0
 
LVL 24

Expert Comment

by:Phillip Burton
ID: 40511601
Let's start slowly then. Please try the following, and tell me which formulas give an error or an unexpected result.

=sum(SIGNEDDATA)

=sum(IIf([ACTUAL_BUDGET])="Actual",1,0)



=sum(IIf([ACTUAL_BUDGET])="Actual",SIGNEDDATA,0)
0
 

Author Comment

by:rhservan
ID: 40512118
0
 

Author Comment

by:rhservan
ID: 40512135
UPDATE - Disregard previous above communication.

I moved the parentheses to the end.  Which gave more of a result. However, still not correct. I added the column outside of the group in the design, thinking it would give a single column in the result. But not. See attached file. 2 problems still exist:

1. Need a single column for the result
2. Need the subtraction to work correctly

=sum(IIf(Fields!ACTUAL_BUDGET.Value="Budget",Fields!SIGNEDDATA.Value,0))-
sum(IIf(Fields!ACTUAL_BUDGET.Value="Actual",Fields!SIGNEDDATA.Value,0))

GIVES ME THIS:
Result.rtf
0
 
LVL 24

Accepted Solution

by:
Phillip Burton earned 500 total points
ID: 40514646
It depends how you inserted the column.

Start again with two columns, then right-hand click on the second column and select Insert Column - Outside Group - Right.

You can then insert this formula in the third column.

If you find this is not working, then instead of using a Matrix, use a Table, and do the grouping/pivotting in SQL instead of leaving it to SSRS.
0

Featured Post

Backup Solution for AWS

Read about how CloudBerry Backup fully integrates your backups with Amazon S3 and Amazon Glacier to provide military-grade encryption and dramatically cut storage costs on any platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
push and Pull replication 31 48
Sql case statement to calculate totals 5 37
SQL works but want to get the XML node data separately 11 30
UPDATE JOIN multiple tables 5 23
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Viewers will learn how the fundamental information of how to create a table.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question