How to find the difference of two columns in deski

Hi Everyone,
I have a deski report which is build from a single query. The report contains two tables.
Table-1:MTK Loc
           MTKnet
Table-2:WTK Loc
            WTKnet
Now i need to find the difference of the columns WTKnet and MTKnet.
These two are report level variables.Their definitins are as  below:
MTKnet:=Sum((<Fees Collected by Per Collected>) In Body) ForEach <vMTKLocation>
WTKnet:=Sum((<Fees Collected by Per Collected>) In Body) ForEach <vWTKLocation>
Where <Fees Collected by Per Collected> is universe variable.
Please help...
Thanks in Advance......

Hi Bol,
As I understand you are taking MTK_Loc and WTK_Loc together in  the report which have common values under Fees Collected by Per Collected  column.
Please follow the steps mentioned below:
1.  Calculate the Variables MTK_Net as
       =Sum(<Fees>) IN <MTK_Loc>
2.  Calculate the Variables WTK_Net as
       =Sum(<Fees>) IN <WTK_Loc>
3. You will get the values based on the Locations MTK_Loc and WTK_Loc .
You are using combination of values for MTK_Loc and WTK_Loc hence you will get the variable values in combination.
Insert new column right to the WTK_Net and  write the formula name it Variance.
=<MTK_Net>- <WTK_Net>
The values look like :
MTK_Loc      WTK_Loc             MTK_Net                 WTK_Net             Variance
Chicago           Chicago                16,696,274.43      157,168.26            16,539,106.17
Chicago           Madison               16,696,274.43       274,396.12            16,421,878.31
Chicago           Milvaki                 16,696,274.43       16,622,870.97       73,403.46
Chicago           Pennsylvania        16,696,274.43        4,299.35               16,691,975.08
Chicago           Waukesha             16,696,274.43        22,067.08             16,674,207.35
Here you will see values for MTK_Net are repeated because these are based on the MTK_Loc which is same for all rows i.e. Chicago , same is the case with remaining values of MTK_Loc.
We can not calculate variabnce based on the values like Canada,Pennsylvania for all values as these values come in combination of each other and as these are all connected columns WEBI groups  Measure data based on the Dimension  and variable columns associated with it.
MTK_Loc   WTK_Loc          MTK_Net         WTK_Net          Variance.
Chicago        Chicago           16696274.43        157168.26           16539106.17
However you can compare the values based on the values  as :
1. Drag and Drop MTK_Loc and MTK_Loc separately on the report.
2. Drag and Drop WTK_Loc and WTK_Loc separately and put it on the report, Connect it to the columns MTK_Loc and MTK_Loc columns already dragged. Then you can compare the values
MTK_Loc                MTK_Net                         WTK_LOC                    WTK_Net
Chicago                    16,696,274.43                 Chicago                       157,168.26
Madison                   315,705.91                       Madison                      274,396.12
Manitowoc              362,632.50                        Manitowoc                  359,978.50
Milvaki                    54,172.84                          Milvaki                       16,622,870.97
Pennsylvania             2,966.56                           Pennsylvania               4,299.35
Waukesha                 9,028.03                          Waukesha                      22,067.08
Here I unchecked the option avoid duplicate row aggregation (select table-> format table) thatu2019s why it is showing all values as a  sum of all MTK_Net and WTK_Net values corresponding to Location values..
Here we are using MTK_Loc and WTK_Loc separately and not connected because though values seems same but they are used in combination ( Chicago, Pennsylvania)  in 2 separate tables in DB hence we canu2019t synchronize them by liking these 2 location columns using 2 data providers.
I Hope this is what you want....
Thanks....
Pratik

Similar Messages

  • Find the difference between two columns in an ssrs matrix ? MSCRM

    Hi All,
    I am working in reporting part of our project (On-line MSCRM 2013) & in reporting services.
    I am trying to create report using fetch xml based. Below is the snap what we required the result.
    Kindly help me, how to get the difference in both column. (Its a matrix table where year is grouped).
    We need difference between both year Like (Plan Revenue of 2013 & Plan Revenue of 2014 difference in Plan Revenue Diff section) and same for Actual
    Revenue.
    https://social.microsoft.com/Forums/en-US/054d5ca4-0d38-4dc6-84a8-88866cc228fe/find-the-difference-between-two-columns-in-an-ssrs-matrix-mscrm?forum=crmdevelopment
    Thanks,
    Mohammad Sharique

    Hi Bro,
    I used parametrized option for year and done the report,Currently we are getting values in Difference column now i want to show
    that value in percentage. How can we show the percentage based on that value. Means i want to show the Difference in Percentage. 
    Kindly help me i tried but getting some issue. Below i am mentioning the code and snap with result.
    Below expression using to showing Plan Revenue in Percentage for year.
    =
    Sum(IIF(Fields!new_year.Value =Parameters!StartYear.Value,cdec(Fields!new_planrevenueValue.Value/1000), cdec(0)))
    - Sum(IIF(Fields!new_year.Value =Parameters!EndYear.Value,cdec(Fields!new_planrevenueValue.Value/1000), cdec(0)))
    /IIF(Sum(IIF(Fields!new_year.Value = Parameters!StartYear.Value,cdec(Fields!new_planrevenueValue.Value/1000), cdec(0)))>0,
    (Sum(IIF(Fields!new_year.Value = Parameters!StartYear.Value,cdec(Fields!new_planrevenueValue.Value/1000), cdec(0))))
    ,1)
    )*100))
    Result issue is as below in snap with highlighted in red colour.
    Kindly help me on this issue also :)

  • How to get the difference between two columns in a column group

    Hi All,
    My first time here and really new to programming. I would like to get the difference between 2 columns that are inside 
    a column group.
    Here is my sample table below: The Column Group is PeriodNumber and can only choose 2. like 1 and 2.. I would like to have a third row which will simply calculate the difference between the amounts in PeriodNumber 1 and 2.
                                PeriodNumber          
    Account                    1                            2     
    1) Cash                10,000                15,000
    2) Receivables      12,000                11,500
    3) Equipment          5,000                  5,500
    Total Assets          27,000                32,000

    Hi yabgestopa,
    From your description, you want to get the difference between two columns in a column group. After testing it in my environment, we can use custom code to achieve your requirement. For more details, you can refer to the following steps:
    Copy the custom code below and paste it to your report. (Right-click report>Report Properties>Code)
    Dim Shared Num1 As Integer
    Dim shared Num2 As Integer
    Public Function GetAmount(Amount as Integer, Type as String)
    If Type = "1" Then
    Num1=Amount
    Else
    Num2=Amount
    End If
    Return Amount
    End Function
    Public Function GetDif()
    Return Num1-Num2
    End function
    Right-click the second column to insert a third column with Outside Group-Right.
    Then use the expressions below in the matrix.
    =Code.GetAmount(Fields!Amount.Value,Fields!PeriodNumber.Value)
    =code.GetAmount(Sum(Fields!Amount.Value),Fields!PeriodNumber.Value)
    =Code.GetDif()
    The report looks like below.
    If you have any questions, please feel free to ask.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • How to find the difference between two timestamp column

    Dear All,
    please Solve my issue,
    I have Table name Record which has the following columns,
    Empid in number column, dat in timestamp
    which has the following values
    Expand|Select|Wrap|Line Numbers
    empid dat
    ====== ====
    101 4/9/2012 9:48:54 AM
    101 4/9/2012 9:36:28 AM
    101 4/9/2012 6:16:28 PM
    101 4/10/2012 9:33:48 AM
    101 4/10/2012 12:36:28 PM
    101 4/10/2012 8:36:12 PM
    101 4/11/2012 9:36:28 AM
    101 4/11/2012 4:36:22 PM
    Here I need to display the following columns,
    empid,min(dat) as start,max(dat) as end and difference(max(dat)-min(dat) for each day,
    for eg,
    Empid Strart end difference
    101 4/9/2012 9:48:54 AM 4/9/2012 6:16:28 PM 8.28
    like this.
    Here 3 different days are exists so It should return 3 records with the above mentioned columns,
    Please Help me to get this.
    Thank you,
    Regards,
    Gurujothi
    Edited by: Gurujothi on Apr 25, 2012 4:45 AM

    >
    101 4/9/2012 9:48:54 AM 4/9/2012 6:16:28 PM 8.28
    >
    why 4/9/2012 9:48:54?
    why not 4/9/2012 9:36:28 AM ?
    SQL>
    SQL> with t as
      2  (select  101 empid, to_timestamp('4/9/2012 9:48:54 AM', 'dd/mm/yyyy hh:mi:ss AM') dat from dual union all
      3  select 101, to_timestamp('4/9/2012 9:36:28 AM', 'dd/mm/yyyy hh:mi:ss AM') dat from dual union all
      4  select 101, to_timestamp('4/9/2012 6:16:28 PM', 'dd/mm/yyyy hh:mi:ss PM') dat from dual union all
      5  select 101, to_timestamp('4/10/2012 9:33:48 AM', 'dd/mm/yyyy hh:mi:ss AM') dat from dual union all
      6  select 101, to_timestamp('4/10/2012 12:36:28 PM', 'dd/mm/yyyy hh:mi:ss PM') dat from dual union all
      7  select 101, to_timestamp('4/10/2012 8:36:12 PM', 'dd/mm/yyyy hh:mi:ss PM') dat from dual union all
      8  select 101, to_timestamp('4/11/2012 9:36:28 AM', 'dd/mm/yyyy hh:mi:ss AM') dat from dual union all
      9  select 101, to_timestamp('4/11/2012 4:36:22 PM', 'dd/mm/yyyy hh:mi:ss PM') dat from dual
    10  )
    11  select empid, min(dat) as start_dat
    12  , max(dat) as end_dat
    13  , max(dat)-min(dat) diff
    14  from t
    15  group by empid, trunc(dat)
    16  /
         EMPID START_DAT                                         END_DAT                                           DIFF
           101 04.09.12 09:36:28,000000000                       04.09.12 18:16:28,000000000                       +000000000 08:40:00
           101 04.11.12 09:36:28,000000000                       04.11.12 16:36:22,000000000                       +000000000 06:59:54
           101 04.10.12 09:33:48,000000000                       04.10.12 20:36:12,000000000                       +000000000 11:02:24
    SQL>

  • How to find the difference between two date?

    Hi,
    I currently writing a date comparision program. Below is the idea analogy,
    Currently i need to find how many day differences between 30 July 2003 and 22 June 2004. How can i use java to code it?
    Thanks.

    there doesn't seem to be a direct way but try this:int daysBetween = 0;
    Calendar c = new GregorianCalendar(2004, Calendar.JULY, 30);
    Calendar d = new GregorianCalendar(2003, Calendar.JUNE, 22);
    while (c.get(Calendar.YEAR) != d.get(Calendar.YEAR)) {
        daysBetween += 360;
        d.add(Calendar.DAY_OF_YEAR, 360);
    daysBetween += c.get(Calendar.DAY_OF_YEAR) - d.get(Calendar.DAY_OF_YEAR);This gives the correct result of 404 (= 8 days from June 22 to June 30 + 366 days between July 1 of 2003 and 2004 + 30 days from July 1 to July 30)

  • How to find the difference in object definition between two databases

    Hi,
    Can any one suggest me how to find the difference in object definition between two different databases. Is there any tool or by OEM? If so how?
    Regards
    Naveen

    this link may be helpful...
    http://www.dbspecialists.com/scripts.html

  • How to quickly find the difference of two version of RPD?

    Hi all,
    Does anyone have good idea about quickly finding the difference of two versions of RPD in the project?
    Regards,
    Anne

    This might be of help to you
    http://varanasisaichand.blogspot.com/2010/03/how-to-merge-two-repositories.html
    http://www.rittmanmead.com/2010/07/obiee-11gr1-incremental-patches-to-the-rpd/
    Cheers,
    KK
    Edited by: Kranthi.K on Dec 7, 2011 9:41 PM

  • Need to find the Difference between two table

    Hello ,
    I have stucked in program as below scenario:-
    I have two tables of huge data of same structure in a same schema.I need to find the difference exact values in tables.
    By using MINUS we can find the difference between two table ,i need to find the what exact difference in the there values with colunm and value at that column.
    Example TableA
    Col1 col2 col3 col4 col5.... col50
    10 ABC 2001 EE 444 TT
    40 XYZ 3002 RR 445 TT3
    80 DEF 6005 YY 446 YY8
    TableB
    Col1 col2 col3 col4 col5.... col50
    10 ABC 2001 EE 444 TT
    40 XYZ 3002 RR 445 TT3
    81 DEF 6005 Yu 447 YY8
    I need to the out put like this :-
    The Diffence between two table is
    TableA.COL1=80 TableB.Col1=81, Different
    TableA.Col4=YY TableB.col4=Yu,Different
    TableA.Col5=446TableB.col5=447,Different
    Please suggest me to write the pl/sql program for the same
    thanx in advance
    KK

    Thanx friends for all your efforts
    I have a sample code for the same,this will compare the two tables for single row in each table .
    what r the modification needed for the multiple rows of values in the two tables??
    Please suggest!!
    CREATE OR REPLACE PROCEDURE test_compare
    IS
    TYPE t_col
    IS
    TABLE OF VARCHAR2 (30)
    INDEX BY PLS_INTEGER;
    l_col t_col;
    j NUMBER := 0;
    l_sql VARCHAR2 (2000);
    col1 VARCHAR2 (30);
    col2 VARCHAR2 (30);
    val1 NUMBER;
    val2 NUMBER;
    status VARCHAR2 (30);
    CURSOR c1
    IS
    SELECT column_id, column_name
    FROM all_tab_columns
    WHERE table_name = 'TEST1';
    BEGIN
    FOR i IN c1
    LOOP
    j := j + 1;
    l_col (j) := i.column_name;
    END LOOP;
    FOR k IN 1 .. j
    LOOP
    l_sql :=
    'SELECT '
    || ''''
    || l_col (k)
    || ''''
    || ', '
    || 'TEST2.'
    || l_col (k)
    || ', '
    || ''''
    || l_col (k)
    || ''''
    || ', '
    || 'TEST1.'
    || l_col (k )
    || ', '
    || 'DECODE(TEST2.'
    || l_col (k)
    || ' -TEST1.'
    || l_col (k)
    || ', 0, ''NO CHANGE'', ''CHANGED'') FROM TEST2, TEST1';
    EXECUTE IMMEDIATE l_sql INTO col1, val1,col2, val2, status;
    IF status = 'CHANGED'
    THEN
    DBMS_OUTPUT.put_line( 'TEST2.'
    || col1
    || '='
    || val1
    || ', TEST1.'
    || col2
    || '='
    || val2
    || ', '
    || status);
    END IF;
    END LOOP;
    EXCEPTION
    WHEN OTHERS
    THEN
    DBMS_OUTPUT.put_line ('Error:- ' || SQLERRM);
    END;
    /

  • Find the difference in Two Tabels in two different schema?

    Hello Gurus,
    In DB which have millions of records -
    I have a Tabel A under Schema A and i have another Tabel B under Schema B and i have to pick the refrence from Tabel C under Schedma B altough my DB is same. Both of the tables (Table A and Table B) have exatly the same structure in both the schema and when i tried finding the difference like -
    Find the refrence from Table C and pick the values which are in Tabel A under Schema A but which are not present in the Tabel B under Schema B .
    I have to compare each and ever field value which is present under all of the columns under Table A to ever field value which is present under all of the columns under Table B.
    then wrote the following query-
    SELECT * FROM
    SchemaA.Table A t1,SchemaB.Table C t2
    WHERE t1.SV_ID = t2.SV_ID order by t1.SV_ID
    Minus
    Select * from SchemaB.TableB order by SV_ID
    Then this query is not working. And display the following error -
    "query block has incorrect number of result columns"
    Even both of the tables have the same column's and same structure.
    Kindly help me .
    Looking forward for some guidance -
    Thanks in advance.

    1-There are some 70 Columns in both of the tables so thats why i don't want to use the query based on columns as it will involve writing all of the columns.
    2- By using the query something like -
    select <column_name(s)> from table1
    minus
    select <column_name(s)> from table2, table1
    where <condition>
    It is throwing the error -ORA-01789: query block has incorrect number of result columns
    3- Using the query
    SELECT t1.*
    FROM SchemaA.TableA t1,SchemaB.TableC t2
    WHERE t1.SV_ID = t2.SV_ID
    MINUS
    SELECT t3.*
    FROM SchemaB.TableB t3
    order by SV_ID
    It gives me the reuslt but when i corss check them individually in both of the tables then there is no difference.
    4- SELECT t1.* FROM
    SchemaA.Table A t1,SchemaB.Table C t2
    WHERE t1.SV_ID = t2.SV_ID order by t1.SV_ID
    Minus
    Select * from SchemaB.TableB order by SV_ID
    Query is not working.
    Kindly help me to find the difference between two tables , column by column based on the condition both of the tables have the same SV_ID.

  • How to get the difference of two dates in years,months and days

    Hi friends,
    how to get the difference of two dates in years,months and days
    for ex 2 years 3 months 13 days
    select (sysdate-date_Start) from per_periods_of_service
    thanks

    Something like this...
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select to_date('17-nov-2006','dd-mon-yyyy') as c_start_date, to_date('21-jan-2008','dd-mon-yyyy') as c_end_date from dual union all
      2             select to_date('21-nov-2006','dd-mon-yyyy'), to_date('17-feb-2008','dd-mon-yyyy') from dual union all
      3             select to_date('21-jun-2006','dd-mon-yyyy'), to_date('17-jul-2008','dd-mon-yyyy') from dual
      4             )
      5  -- end of test data
      6  select c_start_date, c_end_date
      7        ,trunc(months_between(c_end_date, c_start_date) / 12) as yrs
      8        ,trunc(mod(months_between(c_end_date, c_start_date), 12)) as mnths
      9        ,trunc(c_end_date - add_months(c_start_date, trunc(months_between(c_end_date, c_start_date)))) as dys
    10* from t
    SQL> /
    C_START_D C_END_DAT        YRS      MNTHS        DYS
    17-NOV-06 21-JAN-08          1          2          4
    21-NOV-06 17-FEB-08          1          2         27
    21-JUN-06 17-JUL-08          2          0         26
    SQL>But, don't forget that different months have different numbers of days, and leap years can effect it too.

  • How to find the difference between Project costs & Cost center costs?

    Hi all,
    Can you please explain me ? What is project Cost & Cost center cost and which are the tables having those fields of project cost & cost center Costs? And how to find the difference between their costs ? And please give me the functional Idea about it?
    Thanking you all in Advance...
    Regards,
    Chandru

    Hi,
    goto table COSP:
    1) object-no. beginning with 'KS' refer to cost-centre
       example: 'KSKOKA4711'
       with KS, KOKA = controlling area and 4711 = cost centre
    2) OBJNR beginning with 'PR' refer to projects / WBS-element
       example PR00001234
    Message was edited by: Andreas Mann

  • Extract Time from date and Time and Need XLMOD Funtion to find the Difference between Two Time.

    X6 = "1/5/15 5:16 AM" & NOW ....................difference by Only Time
    not date
    X6 date and Time will be changing, Its not Constant
                Dim myDateTime As DateTime = X6
                Dim myDate As String = myDateTime.ToString("dd/MM/yy")
                Dim myTime As String = myDateTime.ToString("hh:mm tt")
                Dim myDateTime1 As DateTime = Now
                Dim myDate1 As String = myDateTime1.ToString("dd/MM/yy")
                Dim myTime1 As String = myDateTime1.ToString("hh:mm tt")
    Need to use this function to find the Difference between Two Time. due to 12:00 AM isuue
    Function XLMod(a, b)
        ' This replicates the Excel MOD function
        XLMod = a - b * Int(a / b)
    End Function
    Output Required
     dim dd  = XLMod(myTime - myTime1)
    Problem is myTime & myTime1 is String Need to convert them into Time, Later use XLMOD Funtion.

    Induhar,
    As an addendum to this, I thought I'd add this in also: If you have two valid DateTime objects you might consider using a class which I put together a few years ago
    shown on a page of my website here.
    To use it, just instantiate with two DateTime objects (order doesn't matter, it'll figure it out) and you'll then have access to the public properties. For this example, I'm just showing the .ToString method:
    Option Strict On
    Option Explicit On
    Option Infer Off
    Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) _
    Handles MyBase.Load
    Dim date1 As DateTime = Now
    Dim date2 As DateTime = #1/1/1970 2:35:00 PM#
    Dim howOld As New Age(date1, date2)
    MessageBox.Show(howOld.ToString, "Age")
    Stop
    End Sub
    End Class
    I hope that helps, if not now then maybe at some point in the future. :)
    Still lost in code, just at a little higher level.
      Thanx frank, can use this in Future....

  • Function Module to find the Difference between two times.

    Hi All,
    Wud you plz let me know the Function Module to find the Difference between two times.
    Input Time1( Hours:Minutes) Time2 ( Hours:Minutes)
    Need Output in Hours:Minutes only . ( No seconds Needed )
    Ex :
    Input :
           06:00 to 18:00 Output : 12:00
    and  20:00 to 06:00 Output: 10:00 with +ve sign only. No -ve sign.
    Thanks,
    N.L.Narayana

    check this .
    data : p_timel like sy-uzeit,
           p_timeh like sy-uzeit,
           diff like sy-uzeit,
           di(8) type c .
           p_timel = '200000'.
           p_timeh = '060000'.
           diff = p_timeh - p_timel.
           concatenate diff+0(2) ':' diff+2(2) into di.
           write:/ di.
    also check for this.
           p_timel = '060000'.
           p_timeh = '180000'.
    see if this can be implemented in ur code .
    or else  u can try with  Fm L_TO_TIME_DIFF passing startdate enddate starttime endtime with UOM as MIN
    hope this helps regards,
    vijay

  • How to find the difference between 2 time values in Java

    hi all,
    i have 2 time values
    String time1="6:20";
    String time2="21:30"
    How to find the difference between 2 times in Java?
    pls help
    thanx in advance....

    Calculating Java dates: Take the time to learn how to create and use dates
    Working in Java time: Learn the basics of calculating elapsed time in Java
    Formatting a Date Using a Custom Format
    Parsing a Date Using a Custom Format

  • How to find the difference of 2 fields in template?

    Hi,
    I am building an rtf template, I have two fields in the template which come from XML extract.
    I need to add one more column to the template which is the differecnce of the 2 columns (column1-column2).
    I don't have this column in the XML extract, I need to calculate this in the template.
    I am quiet new to using XML Publisher.
    Could somebody please tell me, how can I achieve this?
    Thanks in Advance,
    Thiru

    Hi,
    I am able to find the difference by <?(column1tag)-(column2tag)?>.
    But now I want to have the sum of this field at different levels
    <?sum((column1tag)-(column2tag))?> is not working giving some error.
    Could somebody please help me out, how can I achieve sum for this?
    Thanks in Advance,
    Thiru

Maybe you are looking for

  • How do I get iTunes to keep playing (radio) when I am not using the compute

    How do I get iTunes to keep playing - radio or CD - when the computer is otherwise idle? It cuts off after about 5 minutes and goes into sleep mode. thanks, Vlasta

  • When is it safe to update a task sequence?

    We have a fairly busy environment, with OSD happening all the time. We have been updating our major task sequences off hours, but I wonder if that is even necessary. After testing in QA, is it safe to update the task sequence at any time without both

  • MS Word for iPad won't connect to OneDrive

    I just downloaded MS Word for iPad (and I have a subscription to MS Office 365). The install went fine, but when I log in, it doesn't access my OneDrive folders. It shows two generic folders (Documents and Public), but if I click on Documents, for ex

  • Need quick response if possible please (pop/clicks throughout project)

    i've made many cd's with waveburner. i've imported regular 16bit tracks and created an order the cd. The cd's are nothing fancy just a few earlier fades than the original audio track...changing gaps to 1 sec instead of 2 sec. Then bounced the project

  • Endorsed directory

    Hello, I recently downloaded the Java Web Services Developer Pack and I'm trying to use the XML parsers (SAX and DOM) with jdk 1.4.2. I've copied the contents of the "jaxp-1.2.2/jaxp/endorsed" directory from the web services install directory to the