Help with query to show differences between two tables

I have two tables that are identically defined. I need to capture changes to the old table. Want a result set that shows the following. I need to know what is new, change, or deleted.  Thanks
X1,n,new
z0,n,delete
z2,y,change
z3,n,change
drop table ifs_rmapopold
create table ifs_rmapopold (rqappl varchar(2), rqcardcurr varchar(1))
insert into ifs_rmapopold (rqappl, rqcardcurr) values ('z0', 'n'), ('z1', 'n'), ('z2', 'n'), ('z3', 'y')
drop table ifs_rmapopnew
create table ifs_rmapopnew (rqappl varchar(2), rqcardcurr varchar(1))
insert into ifs_rmapopnew (rqappl, rqcardcurr) values ('x1', 'n'),('z1', 'n'), ('z2', 'y'), ('z3', 'n'), ('z4', 'n')

Got this clumsy example working. But Sorna answer is  really nice.
create table #temptable (rqappl varchar(2), rqcardcurr varchar(1), updateind varchar(10))
-- change, get new value
insert into #temptable
select n.*, 'change' from ifs_rmapopnew n
inner join ifs_rmapopold o on n.rqappl = o.rqappl and n.rqcardcurr <> o.rqcardcurr
-- new
insert into #temptable
select n.*, 'new' from ifs_rmapopnew n
where rqappl not in (select rqappl from ifs_rmapopold)
-- deleted
insert into #temptable
select o.*, 'deleted' from ifs_rmapopold o
where rqappl not in (select rqappl from ifs_rmapopnew)
select * from #temptable

Similar Messages

  • API for tools that show differences  between two file in applet

    I am searching Api for tools that show differences between two data file
    that represent as bytes[] in the memory in applet .
    the applet is not sign Applet.

    I gotta it.
    File f=new File("\\\\"+"Linshuaibing"+"\\card\\DSC00134.jpg");[Thank you very much v!

  • 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;
    /

  • How to find the structural difference between two tables

    Hi all,
    How to find the structural difference between two tables .
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
    PL/SQL Release 11.1.0.7.0 - Production
    CORE 11.1.0.7.0 Production
    TNS for 32-bit Windows: Version 11.1.0.7.0 - Production
    NLSRTL Version 11.1.0.7.0 - Production
    Thanks,
    P Prakash

    you could try something similar to this, for each table pair that you want to compare:
    SELECT 'TABLE_A has these columns that are not in TABLE_B', DIFF.*
      FROM (
            SELECT  COLUMN_NAME, DATA_TYPE, DATA_LENGTH
              FROM all_tab_columns
             WHERE table_name = 'TABLE_A'
             MINUS
            SELECT COLUMN_NAME, DATA_TYPE, DATA_LENGTH
              FROM all_tab_columns
             WHERE table_name = 'TABLE_B'
          ) DIFF
    UNION
    SELECT 'TABLE_B has these columns that are not in TABLE_A', DIFF.*
      FROM (
            SELECT COLUMN_NAME, DATA_TYPE, DATA_LENGTH
              FROM all_tab_columns
             WHERE table_name = 'TABLE_B'
             MINUS
            SELECT COLUMN_NAME, DATA_TYPE, DATA_LENGTH
              FROM all_tab_columns
             WHERE table_name = 'TABLE_A'
          ) DIFF;that's assuming, column_name, data_type and data_length are all you want to compare on.

  • Find Differences between two tables at column level

    Hi,
    I have 2 tables one live table and the other History table..
    If i have to find differences between live table and the latest version in the History table and also find which column got chaanged
    How would i do that for a table which has many columns and i need each column for which the value has changed for a id
    for ex:
      Table 1   (LIve)                           Table 2 (History)
    ID col1     col2    Version               ID       col1     col2    Version
     1   ABC     123     V1                     1       ABCD   123     v2
     2   NBS     1234   V1                     2        NBS     123     V2
    Result set should be 
    Result Set:
    ID col which changed
    1    col1
    2    col2   
    Because the values for that column had been changed
    Except gives me all the differences not just the column level ..

    The dynamic version using schema views... :D
    --Build a coulple OF testing tables to play with
    CREATE TABLE dbo.Table1 (
    ID INT IDENTITY(1,1) PRIMARY KEY,
    Col1 INT,
    Col2 INT,
    Col3 INT
    CREATE TABLE dbo.Table2 (
    ID INT IDENTITY(1,1) PRIMARY KEY,
    Col1 INT,
    Col2 INT,
    Col3 INT
    INSERT dbo.Table1 (Col1,Col2,Col3) VALUES
    (123,456,789),
    (111,222,333),
    (444,555,666),
    (777,888,999),
    (321,345,769),
    (179,753,758),
    (362,362,236),
    (856,874,896),
    (821,729,324)
    INSERT dbo.Table2 (Col1,Col2,Col3) VALUES
    (123,456,789),
    (111,999,333), --col2 diff
    (444,555,666),
    (777,888,999),
    (321,345,123), --col3 diff
    (179,753,758),
    (362,362,236),
    (234,874,896), --col1 diff
    (821,729,324)
    And then the actual solution...
    DECLARE
    @t1 VARCHAR(10) = 'Table1',
    @t2 VARCHAR(10) = 'Table2'
    IF OBJECT_ID('tempdb..#temp') IS NOT NULL DROP TABLE #temp
    SELECT
    c.TABLE_SCHEMA,
    c.TABLE_NAME,
    c.COLUMN_NAME,
    c.ORDINAL_POSITION,
    CASE WHEN u.COLUMN_NAME IS NOT NULL THEN 1 ELSE 0 END AS PK
    INTO #temp
    FROM
    INFORMATION_SCHEMA.COLUMNS c
    JOIN INFORMATION_SCHEMA.TABLES t
    ON c.TABLE_NAME = t.TABLE_NAME
    AND c.TABLE_SCHEMA = t.TABLE_SCHEMA
    LEFT JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE u
    ON c.COLUMN_NAME = u.COLUMN_NAME
    AND c.TABLE_NAME = u.TABLE_NAME
    AND c.TABLE_SCHEMA = u.TABLE_SCHEMA
    AND OBJECTPROPERTY(OBJECT_ID(constraint_name), 'IsPrimaryKey') = 1
    WHERE 1 = 1
    AND t.TABLE_TYPE = 'BASE TABLE'
    AND c.TABLE_NAME IN (@t1,@t2)
    ORDER BY
    c.TABLE_SCHEMA, c.TABLE_NAME, c.ORDINAL_POSITION
    DECLARE @select VARCHAR(MAX)
    SELECT @select = COALESCE(@select + ', ', '') + t.TABLE_SCHEMA + '.' + t.TABLE_NAME + '.' + t.COLUMN_NAME
    FROM #temp AS t
    ORDER BY t.TABLE_NAME, t.ORDINAL_POSITION
    DECLARE @from VARCHAR(MAX)
    SELECT @from = COALESCE(@from + ' FULL JOIN ', '') + t.TABLE_SCHEMA + '.' + t.TABLE_NAME
    FROM #temp AS t
    WHERE t.PK = 1
    ORDER BY t.TABLE_NAME
    DECLARE @on VARCHAR(MAX)
    SELECT @on = COALESCE(@on + ' = ', '') + t.TABLE_SCHEMA + '.' + t.TABLE_NAME + '.' + t.COLUMN_NAME
    FROM #temp AS t
    WHERE t.PK = 1
    ORDER BY t.TABLE_NAME, t.ORDINAL_POSITION
    DECLARE @where VARCHAR(MAX)
    SELECT @where = COALESCE(@where + CASE WHEN t.TABLE_NAME = @t1 THEN ' OR ' ELSE ' <> ' END, '') + t.TABLE_SCHEMA + '.' + t.TABLE_NAME + '.' + t.COLUMN_NAME
    FROM #temp AS t
    WHERE t.PK = 0
    ORDER BY t.ORDINAL_POSITION, t.TABLE_NAME
    DECLARE @sql VARCHAR(MAX) = '
    SELECT ' + @select + '
    FROM ' + @from + '
    ON ' + @on + '
    WHERE ' + @where
    EXEC (@sql)
    HTH,
    Jason

  • Most elegant way to get difference between two tables - not minus!!!

    Hi,
    Simplified example of what I am trying to achieve - I have two tables ORIGINAL and REVISED.
    My desired result is to compare the two, such that; -
    Where data exists in both tables I get the difference between the Budget column, and if there is no difference then I want no rows.
    Where data exists in ORIGINAL but not in revised I want the inverse of the current value of the Budget column.
    Where data exists in REVISED I want the value from REVISED.
    I can see how I can do this, cf below, but is there a more elegant solution??
    Data for table ORIGINAL
    select '801040' entity, '2186' expense_type, 234000 budget
    from dual
    union all
    select '801040' entity, '3001' expense_type, 1000 budget
    from dual
    union all
    select '801040' entity, 'P132' expense_type, 34000 budget
    from dual
    union all
    select '801040' entity, 'P135' expense_type, 43000 budget
    from dualData for table REVISED
    select '801040' entity, '2186' expense_type, 235000 budget
    from dual
    union all
    select '801040' entity, 'P132' expense_type, 34000 budget
    from dual
    union all
    select '801040' entity, 'P139' expense_type, 56000 budget
    from dualDesired output
    ENTITY EXPENSE_TYPE DIFFERENCE
    801040 2186 1000
    801040 3001 -1000
    801040 P135 -43000
    801040 P139 56000
    5 rows selected.
    Current code to achieve this, is there a better way??
    select original.entity
    ,      original.expense_type
    ,       (nvl(revised.budget,0) - original.budget) as difference
    from   original
    ,      revised
    where  original.entity = revised.entity(+)
    and    original.expense_type = revised.expense_type(+)
    and   (nvl(revised.budget,0) - original.budget) != 0
    union all
    select  revised.entity
    ,       revised.expense_type
    ,       revised.budget as difference
    from   revised
    where  not exists
    (select 'x'
    from   original
    where  original.entity = revised.entity
    and    original.expense_type = revised.expense_type)
    and    revised.budget != 0Many thanks for your input,
    Robert.
    Edited by: Robert Angel on 17-Jan-2012 03:31 to change not equals to != - thanks for heads up

    Use full outer join:
    with original as (
                      select '801040' entity, '2186' expense_type, 234000 budget from dual union all
                      select '801040' entity, '3001' expense_type, 1000 budget from dual union all
                      select '801040' entity, 'P132' expense_type, 34000 budget from dual union all
                      select '801040' entity, 'P135' expense_type, 43000 budget from dual
          revised as (
                      select '801040' entity, '2186' expense_type, 235000 budget from dual union all
                      select '801040' entity, 'P132' expense_type, 34000 budget from dual union all
                      select '801040' entity, 'P139' expense_type, 56000 budget from dual
    select  nvl(o.entity,r.entity) entity,
            nvl(o.expense_type,r.expense_type) expense_type,
            nvl(r.budget,0) - nvl(o.budget,0) budget
      from      original o
            full join
                revised r
              on (
                      r.entity = o.entity
                  and
                      r.expense_type = o.expense_type
      where nvl(r.budget,0) - nvl(o.budget,0) != 0
    ENTITY     EXPE         BUDGET
    801040     2186           1000
    801040     3001          -1000
    801040     P135         -43000
    801040     P139          56000
    SQL> SY.

  • How to find structural differences between two tables?

    I want to find the difference in structure between objects in two 11g databases:
    Here I want to identify:
    tables/ Views with same columns, same datatype, precision and constraints
    Identify if the same indexes and triggers are present.
    I do not want to compare the data.
    can someone give suggestions on this please?

    my first resource for SQL Developer questions is (That) Jeff Smith: http://www.thatjeffsmith.com/archive/2012/09/sql-developer-database-diff-compare-objects-from-multiple-schemas/.

  • Difference between two timestamp.

    Hi,
    I want to find difference between two timestamp in minutes.
    Actually i want to retrieve difference between current timestamp and the timestamp taken from the table
    select log_time from serv_info where server_id = 1;
    Can anyone tell me the query to find difference between two timestamps in minutes.
    -haifriends

    SQL> WITH serv_in AS
         (SELECT SYSTIMESTAMP - 1 / 4 log_time,
                 SYSTIMESTAMP now
            FROM DUAL)
    SELECT log_time,
           now,
             24 * 60 * EXTRACT (DAY FROM (now - log_time))
           + 60 * EXTRACT (HOUR FROM (now - log_time))
           + EXTRACT (MINUTE FROM (now - log_time))
           + 1 / 60 * EXTRACT (SECOND FROM (now - log_time)) diff_in_minutes
      FROM serv_in
    LOG_TIME  NOW                                 DIFF_IN_MINUTES
    01-MRZ-07 01-MAR-07 03.47.42.107462 PM +01:00      360,001791

  • Get Differences between two databases

    Hello there,
    I need to check if there are differences between 2 databases, both on 10g. As I do not want to check all tables, triggers, procedures and so on manually I wonder whether there is a script where I just need to give the db_names for checking both databases?
    best regards,
    Jörn

    Hi there,
    first, I need to know structural differences like row datatypes, indexes or triggers. I don't need to know what exactly is different just which objects.
    Second, I would also like content - differences between two tables, so the exact table data compared to each other. But this is not as important as the first one.
    best regards
    Jörn

  • Better estimation of phase difference between two signals with variable frequency!

    Hello LabView Gurus, 
    Being a power engineer and having just a little knowledge of signal processing and labview, I have been pulling my hair out for the last couple of days to get a better estimation of phase difference between two signals.
    We have two analog voltage signals; 1. sine wave (50Hz ± 1Hz) and 2. a square wave with exactly half of sine wave frequency at any time.
    At the starting point of operation (and simulation/acquisition) both signals will have no phase difference. However, the square wave's frequency changes unpredictably for a just a few millisecond but then it gets synchronized with sine wave's frequency again. This means that the square wave will be phased out from its original position. The task of the labview is to find the phase difference between the two signals continuously.
    My approach to determine the phase difference is to measure the time when sine wave crosses zero amplitude and the time when the very next square wave changes amplitude from zero volts to +ve voltage (I have a 0.5volts threshold just to avoid any dramas from small line noise). The difference between these times is then divided by the time period and multiplied by 360 to get this phase difference in angles. 
    As this part is just a small block of a big project, I can only allow 5000Hz sampling rate each for both signals. I read 500 samples (which means I read data from 5 cycles of sine wave and 2.5 cycles of square wave).
    Now the problem is, as long as the frequency of sine wave stays constant at exactly 50Hz, I get a good estimation of the phase difference but when the frequency changes even a little (and it will happen in the real scenario i.e 50Hz ± 1Hz  and the square wave's frequency is dependent of sine wave's frequency), the estimation error increases.
    I have attached my labview program. From front panel, you can set the phase of square wave (between -180 and 0) and you should see the labview's calculated phase in the indicator box named 'Phase'. Then you can press 'Real Frequency' switch that would cause the frequency to change like it would in real operation.
    You can observe that the estimation error increases after you push the button. 
    All I need to do is to reduce this estimation error and make it as close to the actual phase difference as possible. Any help would be greatly appreciated.
    I am using LabView 2009 for this task.
    The application is for electric machines and the stability/performance of machines under different faults.
    Thank you for reading this far!
    Regards,
    Awais
    Attachments:
    v603.png ‏320 KB
    v603.vi ‏186 KB

    Jeff Bohrer wrote:
    Basic math gives me a bit of pause on this approach.  You are sampling at 50 times the frequency of interest so you get 50 samples per cycle.  your phase resolution is 1/50th cycle or 7.2 degrees +/- noise.  You will need to samlpe faster to reduce phase resolution or average multiple readings (at a time cost that is signifigant)
    Jeff- (Hardly Working)
    I am sampling at 100 times the sine wave's frequency and 200 times the square wave's frequency.  Increasing the sampling rate completely solves my problem. But since I am acquiring several other inputs, I cannot afford a sampling rate higher than 5kHz.
    F. Schubert wrote:
    I'm not a signal processing expert, but here my basic understanding.
    If you simulate sampling with 5kHz and a frequency of 50 Hz (and both are 'sync' by design), you always get an exact 5 periods. Any variation of your signals frequency gives you a propability to get 4 or 6 'trigger' events. That's an up or down of 20%!
    The one measure to reduce such problems is using 'window functions'. They don't fit your current approach (counting instead of a DSP algorithm), so this needs to be reworked as well.
    My approach would be to use the concept of a Locki-In amplifier. You need to phaseshift your ref-signal by 90°. Then multiply your measurement signal with the ref signal and the phase shifted ref signal. The obtained values for x/y coordinates of a complex number. Calculate the theta of the complex number (with the LV prim). Feed this in a low pass filter.
    The trick on this is, that the square wave has harmonics in it, in this you are interested in the second harmonic which is the sine wave.
    To get rid of the effect that the sync between sampling rate and ref signal frequency gives an error, you then can use the window I mentioned above (place it before the lock-in).
    For a design that really plays well, use a producer-consumer design pattern to get the calculations done in parallel with the DAQ.
    I suggest you to check on wikipedia for some of the keywords I mentioned. Go also for the external links which lead to great tutorials and AppNotes on the signal processing basics.
    Sorry, it's not a simple solution I offer and we will have quite some conversation on this forum if you follow this path. Maybe someone else knows a simpler way.
    Felix
    www.aescusoft.de
    My latest community nugget on producer/consumer design
    My current blog: A journey through uml
    An interesting view. the sine wave can indeed be looked as a second harmonic of the square wave. I will implement your idea and get back to you as soon as I get some results. But since I have very limited knowledge of signal processing, it might take me a while to get my hear around the solution you mentioned.

  • Difference between two dates in seconds/milliseconds with Expressions

    Hi,
    I need to write a query using Expression(Builder) which calculates the difference between two columns (date/timestamps). As of other requirements I am not able to use JPQL, so I tried to create the query with the Expression framework. The difference between the two dates can be calculated with the
    ExpressionMath.substract(...)
    method. The result is a Date-like object storing the difference between both dates. But how can I cast this difference to a long or something like this with expressions?
    Thanks,
    Thomas

    Date functions are very database dependent, as each database has its own set of functions for processing dates.
    The functions are defined in the Expression class, you can try,
    truncateDate, roundDate, or datePart
    http://www.eclipse.org/eclipselink/api/1.1.2/org/eclipse/persistence/expressions/Expression.html#truncateDate(java.lang.String)
    http://www.eclipse.org/eclipselink/api/1.1.2/org/eclipse/persistence/expressions/Expression.html#roundDate(java.lang.Object)
    http://www.eclipse.org/eclipselink/api/1.1.2/org/eclipse/persistence/expressions/Expression.html#datePart(java.lang.String)
    James : http://www.eclipselink.org

  • [Urgent] Need help calculating difference between two dates

    I'm trying to write a code to display the current day and time, then accept two dates from the user and display the difference between the two dates. To display the current date and time, I've used the SimpleDateFormatter library but I'm having difficulty calculating the difference between two dates. Could someone please help me with this?
    Below is my code so far
    import java.util.Date;
    import java.util.Scanner;
    import java.text.SimpleDateFormat;
    public class DateFormatter {
         public void displayNow()
              Date todaysDate = new Date();
              SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MMM-dd HH:mm:ss");
              String formattedDate = formatter.format(todaysDate);
              System.out.println("Today's date and time is: "+formattedDate);
         public void calculateDifference(Date startDate, Date endDate)
              /* This is whre i need help! */
         public static void main(String[] args)
              DateFormatter df = new DateFormatter();
              Scanner sc = new Scanner(System.in);
              df.displayNow();
              System.out.println("Please enter a date: ");
              String date1 = sc.next();
              System.out.println("Please enter another date: ");
              String date2 = sc.next();
    }The methods displayNow() and calculateDifference(Date startDate, Date endDate) are essential and cannot be skipped out.

    tarahmarie101 wrote:
    Dude. I've tried doing assignments under pressure, and it doesn't work. Here's a piece of free advice. Start earlier next time, don't put "urgent" in the title of your post b/c it just pisses people off around here--and is a sure sign of an overdue homework assignment which no one around here likes helping with, and try to ask intelligent questions--don't just say "Help me!"
    Of course, it takes some time to learn what the intelligent questions are. You have my sympathy. Try asking questions about how to do a particular task, instead of asking people to tell you what to do. It starts to get easier after a while.
    actually dude i started on this on monday.. but there were so many other stuff to do along with this.. and i did try referring up the Calendar utility but it was a bit confusing actually.. it was only after that did i come to this forum.. nor am i very good at Java.. anyhoo thanks for your sympathies :P

  • Difference between two date in bex query

    Hi all,
    I need to do a difference between two date using formula variable processing type customer exit beaucause I must use factory calendar in the formula.
    How can I do it?
    Can you give me an example of the routine?
    Thanks a lot
    Gianmarco

    Hi,
    You can still use the same code to copy it and customize as per your need. All you need to do is to subract the dates using the class: CL_ABAP_TSTMP after converting to timestamp and resulting seconds you convert back to days....Please get help from the developers to do this...
    Also, ensure that you write back this difference value to your variable so you get it on the reports for your calculations...
    Cheers,
    Emmanuel.

  • 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 :)

  • 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....

Maybe you are looking for