How to calculate Sales percentage difference between selected year and its previous year in a Matrix

Hi,
I'm trying to generate a report using matrix like this
                                                      Month
Product     PreviousYearSalesAmount    SelectedYearSalesAmount      %SalesDifference
I can populate year sales amount, but i cant calculate the percentage.
Can Anyone help me please.
Note: Month and Year are passed as parameters.
Thank you.

Hi Abhiram,
As per my understanding you can show your fields in matrix.
Only problem is to create the additional column which will have the  %SalesDifference value right?
If yes,
Just create one column as shown in below screen,
It will create one column, Name the header of this newly created column as %SalesDifference
In below this header , where you want to show the value for %SalesDifference as
=sum(iif(Fields!year.Value=Parameters!year.Value,(Fields!SalesAmount.Value),-Fields!SalesAmount.Value))/Fields!SalesAmount.Value
Set the property of the column in number as Percentage.
run the report, you will see as below screen.
For your reference I am attaching my RDL code, you can save as .rdl file and run the report (sample Data inside the report only)
<?xml version="1.0" encoding="utf-8"?>
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
<Body>
<ReportItems>
<Textbox Name="textbox1">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Matrix</Value>
<Style>
<FontFamily>Tahoma</FontFamily>
<FontSize>14pt</FontSize>
<FontWeight>Bold</FontWeight>
<Color>SteelBlue</Color>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Center</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<rd:DefaultName>textbox1</rd:DefaultName>
<Height>0.37in</Height>
<Width>5in</Width>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
<Tablix Name="Tablix1">
<TablixCorner>
<TablixCornerRows>
<TablixCornerRow>
<TablixCornerCell>
<CellContents>
<Textbox Name="Textbox16">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Product</Value>
<Style>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox16</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<BackgroundColor>LightBlue</BackgroundColor>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCornerCell>
</TablixCornerRow>
<TablixCornerRow>
<TablixCornerCell>
<CellContents>
<Textbox Name="Textbox17">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value />
<Style>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox17</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCornerCell>
</TablixCornerRow>
</TablixCornerRows>
</TablixCorner>
<TablixBody>
<TablixColumns>
<TablixColumn>
<Width>1.79722in</Width>
</TablixColumn>
<TablixColumn>
<Width>1.76722in</Width>
</TablixColumn>
</TablixColumns>
<TablixRows>
<TablixRow>
<Height>0.25in</Height>
<TablixCells>
<TablixCell>
<CellContents>
<Textbox Name="SalesAmount">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Sum(Fields!SalesAmount.Value)</Value>
<Style />
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>SalesAmount</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Textbox76">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=sum(iif(Fields!year.Value=Parameters!year.Value,(Fields!SalesAmount.Value),-Fields!SalesAmount.Value))/Fields!SalesAmount.Value</Value>
<Style>
<Format>0.00%</Format>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox76</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
</TablixCells>
</TablixRow>
</TablixRows>
</TablixBody>
<TablixColumnHierarchy>
<TablixMembers>
<TablixMember>
<Group Name="month">
<GroupExpressions>
<GroupExpression>=Fields!month.Value</GroupExpression>
</GroupExpressions>
</Group>
<SortExpressions>
<SortExpression>
<Value>=Fields!month.Value</Value>
</SortExpression>
</SortExpressions>
<TablixHeader>
<Size>0.25in</Size>
<CellContents>
<Textbox Name="month1">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=MonthName(Fields!month.Value)</Value>
<Style>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Center</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<rd:DefaultName>month1</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<BackgroundColor>LightBlue</BackgroundColor>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixHeader>
<TablixMembers>
<TablixMember>
<Group Name="year">
<GroupExpressions>
<GroupExpression>=Fields!year.Value</GroupExpression>
</GroupExpressions>
</Group>
<SortExpressions>
<SortExpression>
<Value>=Fields!year.Value</Value>
</SortExpression>
</SortExpressions>
<TablixHeader>
<Size>0.25in</Size>
<CellContents>
<Textbox Name="year">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!year.Value</Value>
<Style>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Center</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<rd:DefaultName>year</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixHeader>
<TablixMembers>
<TablixMember />
</TablixMembers>
</TablixMember>
</TablixMembers>
</TablixMember>
<TablixMember>
<TablixHeader>
<Size>0.25in</Size>
<CellContents>
<Textbox Name="Textbox61">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>%SalesDifference</Value>
<Style>
<FontStyle>Normal</FontStyle>
<FontWeight>Bold</FontWeight>
<TextDecoration>None</TextDecoration>
<Color>#000000</Color>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Center</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox61</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<BackgroundColor>LightBlue</BackgroundColor>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixHeader>
<TablixMembers>
<TablixMember>
<TablixHeader>
<Size>0.25in</Size>
<CellContents>
<Textbox Name="Textbox62">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value />
<Style>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox62</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixHeader>
</TablixMember>
</TablixMembers>
</TablixMember>
</TablixMembers>
</TablixColumnHierarchy>
<TablixRowHierarchy>
<TablixMembers>
<TablixMember>
<Group Name="Product">
<GroupExpressions>
<GroupExpression>=Fields!Product.Value</GroupExpression>
</GroupExpressions>
</Group>
<SortExpressions>
<SortExpression>
<Value>=Fields!Product.Value</Value>
</SortExpression>
</SortExpressions>
<TablixHeader>
<Size>1.38889in</Size>
<CellContents>
<Textbox Name="Product1">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!Product.Value</Value>
<Style />
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Product1</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixHeader>
</TablixMember>
</TablixMembers>
</TablixRowHierarchy>
<DataSetName>DataSet1</DataSetName>
<Top>0.38in</Top>
<Left>0.04667in</Left>
<Height>0.75in</Height>
<Width>4.95333in</Width>
<ZIndex>1</ZIndex>
<Style>
<Border>
<Style>None</Style>
</Border>
</Style>
</Tablix>
</ReportItems>
<Height>1.20167in</Height>
<Style />
</Body>
<Width>5.1in</Width>
<Page>
<LeftMargin>1in</LeftMargin>
<RightMargin>1in</RightMargin>
<TopMargin>1in</TopMargin>
<BottomMargin>1in</BottomMargin>
<Style />
</Page>
<AutoRefresh>0</AutoRefresh>
<DataSources>
<DataSource Name="DataSource1">
<DataSourceReference>DataSource1</DataSourceReference>
<rd:SecurityType>None</rd:SecurityType>
<rd:DataSourceID>501ee6de-61fb-416f-9a92-011661d01cba</rd:DataSourceID>
</DataSource>
</DataSources>
<DataSets>
<DataSet Name="DataSet1">
<Query>
<DataSourceName>DataSource1</DataSourceName>
<QueryParameters>
<QueryParameter Name="@year">
<Value>=Parameters!year.Value</Value>
</QueryParameter>
<QueryParameter Name="@Month">
<Value>=Parameters!Month.Value</Value>
</QueryParameter>
</QueryParameters>
<CommandText>select * from
select 'apple' Product ,1 month ,2014 year,2000 SalesAmount
union
select 'apple' Product ,1 month,2015 year,3000 SalesAmount
union
select 'dell' Product ,1 month,2014 year,3000 SalesAmount
union
select 'dell' Product ,1 month,2015 year,2500 SalesAmount
union
select 'apple' Product ,2 month,2014 year,1500 SalesAmount
union
select 'apple' Product ,2 month,2015 year,3000 SalesAmount
union
select 'dell' Product ,2 month,2014 year,3000 SalesAmount
union
select 'dell' Product ,2 month,2015 year,5500 SalesAmount
)t
where year between @year-1 and @year
and Month=@Month</CommandText>
<rd:UseGenericDesigner>true</rd:UseGenericDesigner>
</Query>
<Fields>
<Field Name="Product">
<DataField>Product</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="month">
<DataField>month</DataField>
<rd:TypeName>System.Int32</rd:TypeName>
</Field>
<Field Name="year">
<DataField>year</DataField>
<rd:TypeName>System.Int32</rd:TypeName>
</Field>
<Field Name="SalesAmount">
<DataField>SalesAmount</DataField>
<rd:TypeName>System.Int32</rd:TypeName>
</Field>
</Fields>
</DataSet>
</DataSets>
<ReportParameters>
<ReportParameter Name="year">
<DataType>String</DataType>
<DefaultValue>
<Values>
<Value>2015</Value>
</Values>
</DefaultValue>
<Prompt>year</Prompt>
</ReportParameter>
<ReportParameter Name="Month">
<DataType>String</DataType>
<DefaultValue>
<Values>
<Value>1</Value>
</Values>
</DefaultValue>
<Prompt>Month</Prompt>
</ReportParameter>
</ReportParameters>
<Language>en-US</Language>
<ConsumeContainerWhitespace>true</ConsumeContainerWhitespace>
<rd:ReportUnitType>Inch</rd:ReportUnitType>
<rd:ReportID>ee1a8383-6595-42b1-94f2-c68d681c85d3</rd:ReportID>
</Report>
Thanks
Prasad
Mark this as Answer if it helps you to proceed on further.

Similar Messages

  • How to calculate the hour difference between two dates?

    hi all,
    how to calculate the hour difference between two dates?
    eg i trying this...
    ((TO_DATE(TO_CHAR(GRNi.reference_date_4,'hh24:mi'),'hh24:mi') -
    TO_DATE(TO_CHAR(NVL(GRNi.reference_date_3,SYSDATE),'hh24:mi'),'hh24:mi'))*24)*60 Act_Hr
    Reg.
    AAK

    Hi
    To break the diff between 2 dates into days, hours, minutes, sec -- you can use the following:
    select to_char( created, 'dd-mon-yyyy hh24:mi:ss' ),
    trunc( sysdate-created ) "Dy",
    trunc( mod( (sysdate-created)*24, 24 ) ) "Hr",
    trunc( mod( (sysdate-created)*24*60, 60 ) ) "Mi",
    trunc( mod( (sysdate-created)*24*60*60, 60 ) ) "Sec",
    to_char( sysdate, 'dd-mon-yyyy hh24:mi:ss' ),
    sysdate-created "Tdy",
    (sysdate-created)*24 "Thr",
    (sysdate-created)*24*60 "Tmi",
    (sysdate-created)*24*60*60 "Tsec"
    from all_users
    where rownum < 50
    HTH
    RangaReddy

  • Difference between select-option and range

    Hi,
      wat are the difference between  select-option and range
    where u have to use those and give the syntax for the range option.
      if u use range option in report programming there is any advantages ?
      pls reply for this ..
    thanks
    rams

    Hi,
    Not much of a difference,
    A Select-Option could be like,
    SELECT-OPTIONS sel FOR f
    And a Range could be like,
    DATA: BEGIN OF sel OCCURS 10,
             SIGN(1),
             OPTION(2),
             LOW  LIKE f,
             HIGH LIKE f,
          END   OF sel.
    Here they both function the same. But then the Select-Options has numerous options associated with it than the RANGE option.
    Hope it helps,
    Pradip Parmar.

  • If unboxed how could you tell the difference between refurbished imac and new imac?

    If unboxed how could you tell the difference between refurbished imac and new imac?

    Besides all of that, you can purchase Apple Care which will extend your warranty to 3 years just like you can on a brand new iMac.
    If you're considering a "refurbished" iMac, buy it ONLY from Apple.  I believe it's your best bet.

  • How do I print the contrast between "filled" text and its surrounding "box"?

    Hi,
    Apologies in advance for any ambiguity or confusion . . .
    I am a self-taught Photoshop user who has come upon a problem to which I cannot find an answer, despite searching online for hours . . .
    When I design a project, it looks beautiful on screen . . . when I print it, however, it loses the definition between colors inside a font and the shape surrounding the font . . .
    To be more exact:
    I am working at 300 dpi . . .
    I create a rectangle and fill it with red.  I then write text inside of the rectangle and the font color is white.  Onscreen, it looks clear and well-defined.  When I print it, however, there is not clear definition between the font and its surrounding area . . . the colors seem to bleed into each other . . . I have tried using different paper (glossy, matte, etc.), have tried putting a narrow stroke around the text, etc., but nothing help to clearly define the difference between the text and its surrounding shape/color.
    It also does not matter the size of the font, although the larger the font, the easier it is to "see" the difference.  But a white font at 24 point looks no sharper than a white font at 8 pt.
    I am using an Epson XP-610 printer . . . it is a home deskjet and I mainly design for fun, but this "lack of sharpness" on the fonts is driving me crazy.  I would included a screenshot, but it would not help much, since the project looks beautiful and clear on the screen.
    The colors only seem "muddled" when  I print.  Any advice, or even a point in the direction of something I can read to help me understand what to do, would be helpful. . . . TIA!I

    Hullo Cheapster:
    I too am confident that this facility does not exist in relation to the underline function as such. Nor am I aware of a workaround that would let you access it straightforwardly for routine usage in body text. The underline facility, like the strikethrough, is provided because it is standard in some documentation which a wordprocessing might be expected to serve - but as such, it is provided in limited conventional formats. Otherwise, I agree, it is not ideal typography.
    However, for occasional use, there are two workarounds you might like to consider. One is to use the line drawing facility available through the insert menu (insert shape, choose line; then grab its handles to make it horizontal) or the same process initiated from the objects icon in the toolbar.
    Be aware, however, that the above could require further attention to your wrap options: you would need to deselect any wrap - but could still need to modify your line spacing options to avoid irregular line spacings with the rest of your text.
    Possibly simpler is to bear in mind that you can produce an underline without its text. To do this, select underline (Command / U) and type "non-breaking spaces" (option / space). This would allow you to place your underline on a separate line from your underlined text. You could do the same with the strikethrough function, which you access via the effects section in the font panel for closer spacing; or alter the line spacing where you need to do this.
    Either of the above would affect your surrounding text in a way that would make these methods unsuitable for incorporation into body text.
    However, if your interest in doing this relates to headlines or the like, one or other of these options might suit your purpose.
    Regards.

  • Error Message "There is difference between document total and its component

    Error message number 439-138. Is there a sight I could look up error codes?
    There is difference between document total and its components

    Hi Deborah ,
    Please look at this thread..
    Error when adding AP invoice
    So far it looks like a bug
    You can also search in sap service market --support --sap notes
    there are plenty of threads in forum .....
    Hope this helps
    Bishal

  • How to populate the data or details of only the present year and the previous year with respect to the given RATNG?

    Hi All,
    I have created a form with 5 blocks (namely ENQACMHDR, ENQACMDTL, ENQACEHDR, ENQACEDTL, ENQACSPEC), where i have 8 push buttons (namely ENTER_QUERY, EXEC_QUERY, CLEAR, FIRST, NEXT, PREVIOUS, LAST & EXIT).
    This form is created just for viewing purpose only. So after I execute, all the blocks have been blocked against insert & update.
    I query on 2 fields that is 'ENQNO' and 'RATNG' (Both the fields belong to the block ENQACMDTL).
    When I click on 'EXEC_QUERY' directly, all the data of all the years populates.
    But the user wanted the data to be populated from only the present year and the previous year.
    So , on 'WHERE Clause' of the property_palette of 'ENQACMDTL' block , I put in the following condition:
    SUBSTR(ENQACMDTL.ENQNO, 1,4)=TO_CHAR( ADD_MONTHS(SYSDATE,-12) , 'YYYY') OR SUBSTR(ENQACMDTL.ENQNO, 1,4)=TO_CHAR(SYSDATE, 'YYYY')
    PROPERTY PALETTE (ENQACMDTL block)
    WHERE Clause
    SUBSTR(ENQACMDTL.ENQNO, 1,4)=TO_CHAR( ADD_MONTHS(SYSDATE,-12) , 'YYYY') OR SUBSTR(ENQACMDTL.ENQNO, 1,4)=TO_CHAR(SYSDATE, 'YYYY')
    Now the data of only the present year and the previous year is being populated. Its ok with the field of 'ENQNO'.
    The problem is when i query on field 'RATNG' . 'RATNG' is a Text_item with Number of Items displayed=5. (5 rows)
    The following are 2 columns of a Table (Name=ENQACMDTL) in Database.
    ENQNO
    RATNG
    2013900054
    500KC2
    2013900047
    800KC4
    2013520018
    750KC6
    2012900037
    1000KC2
    2012520109
    500KC2
    2012140019
    750KC6
    2011540036
    500KC2
    2011100030
    1000KC2
    2006100007
    90KD8
    2006750014
    750KC6
    2006900072
    500KC2
    The first 4 numbers of 'ENQNO' denotes the year. There are more than a lakhs of records.
    So when i query on the field 'RATNG',
    Example:For RATNG=500KC2;
    I click on ENTER_QUERY, On the field of 'RATNG' , i put in the value 500KC2 and click on  EXEC_QUERY; Details with respect to 500KC2 is displayed as well as all the other unwanted RATNG like 750KC6, 1000KC2 (which belongs to the ENQNO of the present year and the previous year) also gets displayed.
    I want details of only RATNG (500KC2) to be displayed, but only of the present year and the previous year, that is 2013900054, 2012520109 (ENQNO).
    Other than 500KC2 RATNG, no other RATNG must be displayed.
    The RATNG=500KC2 is also present for ENQNO=2011540036 , 2006900072. But I dont want these to be displayed.
    I want only the data or details of the present year and the previous year to be displayed or populated with respect to the given RATNG.
    Can You Help me or tell me what do i do for this?
    Hope I'm clear with my question!!
    If my question is not clear, let me know plz.
    Thank You.
    Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
    Oracle forms 6i.

    On key-exeqry you have to program.  Delete all other trigger codings for checking your condition.
    It dint work on key-exeqry.
    I tried key-exeqry on form trigger, block (enqacmdtl) and also on field(:enqacmdtl.enqno) , but none of them worked.
    It did not display the message.
    I have a 'PUSH-BUTTON:EXEC_QUERY.
    For EXEC_QUERY, Trigger : WHEN_BUTTON_PRESSED;
    I added the following code:
    if to_number(substr(:enqacmdtl.enqno,1,4))<to_number(to_char(add_months(sysdate,-12),'YYYY')) then
         message('The Rating is not present for the present year and the previous year');message(' ',no_acknowledge);
         raise form_trigger_failure;
    else
         execute_query;
    end if;
    It is working fine and the message is being displayed.
    But again I have a new problem and that is;
    On the field :enqacmdtl.enqno, when i enter the '2013%' and press 'EXEC_QUERY', it works fine.
    but when i enter '2006%' and press 'EXEC_QUERY', it shows the following error
    FRM-50016: Legal characters are 0-9 - +E. It does not display the message also.
    but when i enter the complete number, '2006580002', then it works fine , that is it displays the message (The Rating is not present for the present year and the previous year).
    The problem is because of '%', only when i put in the restricted data (which does not satisfy where condition).
    How do i solve this?
    Thank You Priyasagi.

  • How to calculate the phase difference between two square wave (acquired from two channel in one DAQ)

    Hello everyone ,
     I need a quickly help that as below :
    I am trying use PCI-6220 to acquired six signals from one rotation encoder (channel A, channel B,channel Z ,and their non-signals) .The encoder out signals will be square wave and 4000pulses per revolution. I set it rotation at 300rpm speed. I need show every square wave of six out channels in waveform and measure the A-B phase difference to check if the value is correct (designed value should be 90deg) .
    I have no idea how to measure or calculate the phase difference of two square wave base on synchronizate to acquire these two square wave from two channel on the PCI-6620....
    Anyone can give a idea how to calculate the phase difference with two square wave ?
    Thank a lot and Thanks again...
    Tim

    Tim,
    Here is a simple rising edge detector for one channel.
    Lynn
    Attachments:
    Rising edge.vi ‏15 KB

  • How to Calculate Sum of Difference between two dates

    Hi,
    I'm using BI Publisher in Siebel CRM.
    In RTF template I have the following expression to calculate the Difference between dates
    <?xdoxslt:date_diff( 'd' , psfn:totext(CIRGSubmittedDate,"yyyy-MM-dd","MM/dd/yyyy"), psfn:totext(Done,"yyyy-MM-dd","MM/dd/yyyy"), $_XDOLOCALE, $_XDOTIMEZONE)?>
    The above expression works for me to calculate the dates.
    I need to calculate the Sum of all these dates for a Group.
    Want to know the Syntax for Sum function using Date_diff.
    Tried the following and didn't work.
    <?Sum(xdoxslt:date_diff( 'd' , psfn:totext(CIRGSubmittedDate,"yyyy-MM-dd","MM/dd/yyyy"), psfn:totext(Done,"yyyy-aMM-dd","MM/dd/yyyy"), $_XDOLOCALE, $_XDOTIMEZONE))?>
    Not sure what I'm doing wrong here...
    Anyone please help...
    Thanks
    PV

    Hi
    To break the diff between 2 dates into days, hours, minutes, sec -- you can use the following:
    select to_char( created, 'dd-mon-yyyy hh24:mi:ss' ),
    trunc( sysdate-created ) "Dy",
    trunc( mod( (sysdate-created)*24, 24 ) ) "Hr",
    trunc( mod( (sysdate-created)*24*60, 60 ) ) "Mi",
    trunc( mod( (sysdate-created)*24*60*60, 60 ) ) "Sec",
    to_char( sysdate, 'dd-mon-yyyy hh24:mi:ss' ),
    sysdate-created "Tdy",
    (sysdate-created)*24 "Thr",
    (sysdate-created)*24*60 "Tmi",
    (sysdate-created)*24*60*60 "Tsec"
    from all_users
    where rownum < 50
    HTH
    RangaReddy

  • How to calculate the Time difference between 2 dates

    HI All,
    I am using HR_hk_diff_btw_2_dates to calculate the employee service dates.
    For that i  am inputing his hire date and Term dates and Output format as '05' i am getting output perfectly....
    But problem is  whe i am inputting the employee hire date is Dec 1 2007 and Term date is
    March 31 2009 It is coming as 1 year 3 months  31 days instead of 1 year 4 months directly .......How could we make it make last date also working day and get the O/p as 1 year 4 months ?Please Advice..
    Regard
    sas

    1. FM for difference betwwen two times:SCOV_TIME_DIFF
    Import parameters               Value
    IM_DATE1                        2008-01-01
    IM_DATE2                        2008-01-01
    IM_TIME1                        10:00:00
    IM_TIME2                        11:30:00
    Export parameters               Value
    EX_DAYS                         0
    EX_TIME                         01:30:00
    2. SD_CALC_DURATION_FROM_DATETIME : Finds the difference between two date/time and report the difference in hours
    L_MC_TIME_DIFFERENCE : Finds the time difference between two date/time

  • How to calculate the month difference between two date char. in Query?

    Customers would like to see how many months passed between two date type of characteristics (e.g., the month difference between the current date and the scheduled delivery date in the record) and put the result into the column as KF. 
    We would have to grab the fiscal year/period kind of value and then do the subtraction, e.g., if the current date value is 2/28/2008 and the scheduled delivery date value in the record is 12/01/2007, the correct result should be 2 month difference between these two date values, but could someone here give us the technical light on how to make this happen in query design?
    Thanks and we will give you reward points for the correct anwsers!

    Hi Kevin,
    The Badi is RSR_OLAP_BADI.
    You can create an implementation using Transaction  SE18.
    The implementation is per cube and is defined in the filters.
    In the Implementation you have the following methods :
    1. Define : Here you will provide the Keyfigure you need as a virtual one.
    2. Initilialize : Any Init Function you want to do.
    3. Compute. This is called per datarecord and here you can cimpute your value.
    Hope this helps.
    Pralay Ahluwalia

  • How can you tell the difference between ipad 2 and ipad 3 ?

    I need to know how can you tell the defferance between the Ipad 2 and Ipad 3 by just looking at it ?

    Well it hard to tell if you don't have the two side by side and compair it to...

  • Difference between 'Selections from' and 'Search helps' in some HR program

    Hi,
    I notice at the top portions of some programs like Payroll Driver and pre-DME program there's two separate pushbuttons, 'Selections from' and 'Search helps'. What's the diff between the two?
    Because to me, both seem to have same functionality, i.e. to further filter the records.
    When I create customized programs, usually I use logical database pnp, and by that, we are adding 'Selections from' at the selection screen to help further select.
    So my questions:
    1. Why is there another button to help filter? Since both have same functionality to filter.
    2. What's the diff between the 2?
    3. Can somebody confirm the 'Search helps' is really for filtering?
    Thank you.

    Hi,
    If this spool is being generated internal to your program, then sy-spono should have the value.
    Regards,
    Lijo Joseph

  • Scripting option difference between SSMS 2012 and all previous versions

    Hi,
    I recently started to use SSMS 2012 (11.0.2100.60) and have seen some differences in scripting behavior of this version with previous ones (since V9). In previous versions when I want to modify a stored procedure, I right clicked on it
    and selected “Modify”, and had a nice ALTER script. Now, I have a script using sp_executesql which is really not handy for SQL validation checks. After a research, I figured that I can change this behavior in the scripting options by changing the option “check
    for object existence”. Great, it makes the deal!! In fact, no, because now, when I ask to script a DROP and CREATE on a table, I do not have the IF EXSIST part before the DROP anymore.
    The behavior I try to have is:
    When I hit “modify” on a procedure or other programmatic part, I would like to have an alter statement (DROP CREATE is fine too).
    When I choose to script out an object as DROP and CREATE, I would like to have an existence check before the drop.
    This is basically what SSMS did before the version 11 and was very helpful.
    Regards,
    Stef, DBA

    Hi,
    Thanks for your reply.
    What do you think about the behavior?
    Personally, I checked the links you sent. I cannot agree with sentences like “who cares about the outcome of the DROP when the CREATE
    will still work”. When a script runs, it should run without errors, otherwise, how will you detect real issues in the noise? It’s like talking about “normal bug”. Also, “the create procedure must be in its own batch”, that’s what we did with the batch separator
    GO.
    A proper way to script database modifications (outside the tables itself) is to drop the object if it exists and to create it after.
    Why? Because it works in any cases! Also, when I try to modify code, it’s convenient to have validation check against, and that’s why it’s convenient not to have dynamic code. It’s like coding large web sites in notepad. That’s what SSMS 10.50 and below did
    perfectly.
    I use script DROP CREATE capability when I prepare a migration script. Why should I write code when I have tools doing it for me? As
    a DBA, I have to be critic about the script generated and to adapt it if necessary. The MODIFY option is when I debug some code. I expect the tool to validate as much mistakes as possible (yes I do mistakes and I admit it). Like I said before, it’s like working
    with notepad as coding tool, it works, but who will do it?
    I really would like to know if I’m alone on this position.
    Just to make it easier to understand for other people, the following code is what is generated.
    With SSMS 10.50.2806.0 (include IF NOT EXISTS clause = true):
    Scripting a table as “DROP and CREATE”:
    IF 
    EXISTS
    (SELECT
    FROM
    sys.objects
    WHERE
    object_id
    =
    OBJECT_ID(N'[dbo].[ScrapTable]')
    AND
    type
    in
    (N'U'))
    DROP
    TABLE [dbo].[ScrapTable]
    GO
    CREATE
    TABLE [dbo].[ScrapTable](
                    [ScrapID] [int]
    NOT
    NULL
    ON [PRIMARY]
    GO
    Right click on my stored procedure and hit “Modify”:
    ALTER
    PROCEDURE [dbo].[GetScrap]
    AS
    BEGIN
    SET
    NOCOUNT
    ON;
    SELECT
    FROM dbo.ScrapTable
    END
    With SSMS 11.0.2200.60 (check for object existence = false):
    Scripting a table as “DROP and CREATE”:
    DROP
    TABLE
    [dbo].[ScrapTable]
    GO
    CREATE
    TABLE
    [dbo].[ScrapTable](
    [ScrapID]
    [int]
    NOT
    NULL
    ON
    [PRIMARY]
    GO
    Right click on my stored procedure and hit “Modify”:
    ALTER
    PROCEDURE
    [dbo].[GetScrap]
    AS
    BEGIN
    SET
    NOCOUNT
    ON;
    SELECT
    FROM
    dbo.ScrapTable
    END
    With SSMS 11.0.2200.60 (check for object existence = true):
    Scripting a table as “DROP and CREATE”:
    IF 
    EXISTS
    (SELECT
    FROM
    sys.objects
    WHERE
    object_id
    =
    OBJECT_ID(N'[dbo].[ScrapTable]')
    AND
    type
    in
    (N'U'))
    DROP
    TABLE
    [dbo].[ScrapTable]
    GO
    IF
    NOT
    EXISTS
    (SELECT
    FROM
    sys.objects
    WHERE
    object_id
    =
    OBJECT_ID(N'[dbo].[ScrapTable]')
    AND
    type
    in
    (N'U'))
    BEGIN
    CREATE
    TABLE
    [dbo].[ScrapTable](
    [ScrapID]
    [int]
    NOT
    NULL
    ON
    [PRIMARY]
    END
    GO
    Right click on my stored procedure and hit “Modify”:
    IF 
    EXISTS
    (SELECT
    FROM
    sys.objects
    WHERE
    object_id
    =
    OBJECT_ID(N'[dbo].[GetScrap]')
    AND
    type
    in
    (N'P',
    N'PC'))
    BEGIN
    EXEC
    dbo.sp_executesql
    @statement
    =
    N'ALTER PROCEDURE [dbo].[GetScrap]
    AS
    BEGIN
                    SET NOCOUNT ON;
                    SELECT * FROM dbo.ScrapTable
    END
    END
    SSMS 11.0 does it definitely in another way.
    Regards,
    Stef, DBA

  • How we calculate the date difference between two list in SharePoint 2010

    Hi friend's....I have two list first is list1. In this list i have two coulmn start_date and End_date. In second list2 i have two column HolidayName and Holiday_date. Now i want two find the number of day in list1 Excluding Weekend and Holiday_date(that
    column from list2). How i will do ..? Please help me dosto..

    Thanks for reply...
    I have done the date difference in list1. But i want to Exclude the Holiday_date form list2.
    I have list1 - Start_date , End_date, Number_of_day(Exclude weekend and Holiday_date between Start_date and End_date )
    list2 - HolidayName, Holiday_date
    Now how i will calculate the Number_of_day in first list.

Maybe you are looking for