Calculate the months

Hi, could someone help me calculate months in OBIEE, for example:

Start date end date duration in months

1.1.2009 31.10.2010 20

What kind of formula or a function I use in the column: duration in months?

TIMESTAMPDIFF (sql_tsi_month, col1, col2)

See you soon,.

http://cool-bi.com

Tags: Business Intelligence

Similar Questions

  • How to calculate the month on month growth rates in an OBIEE application?

    Hi all

    I would like to ask for your help on how to calculate the months on growth rate previous/[(last month-previous month) month * 100%] in a query OBIEE. This report should always be calculated for the last 2 months available.

    I have the following query:
    Month0 | Months1. Month2
    Produces a 500 | 100. 200
    Product B 600 | 300. 150

    I would like to add month on month column as follows:
    Month0 | Months1. Month2. Month on Month (%)
    Produces a 500 | 100. 200 | + 100.00%
    Product B 600 | 300. 150. -50.00%

    I tried to add a calculated item, but it failed because I couldn't find a way to not show the column calculated in percent with 2 decimal places. In addition, I would ideally prefer to have an automatic update but as far as I understand it can be done in the automatically calculated item

    I also tried to add a new column to the column area and to filter the results for the last month, then for the previous month and then based on that to calculate the necessary ratio but unfortunately it does not work.

    Thank you in advance your advice

    Hello

    The best way to solve this problem is by using the function Ago. With this, you can create a logical column for the previous month. Then you will have 2 columns available with which you can do your calculations.

    If you want to do this with a calculated item (don't know if formatting will work for you), but you can do the more general calculation using $1 for the $2 for the 2 column and 1 column in your calculation. If ($x) columns will change with the columns in your report.

    Concerning

  • calculate the month to date in Obiee11g

    Hello
    I use OBIEE11g, im a problem-

    Problem: results of the beginning of this month beginning of previous month results vs.
    example: If Im in 12 February the calculation is * February 1 to February 12 * also * January 1 to January 12 *.

    -Zia

    Can you give your month there is calculation please?

    It is similar to the AGO (SH. Salesfacts. "" Quantity ", SH. TimesDim. ("" Month ", 1).

  • calculate the time in seconds, the day of the year and year

    I have a data file where they record three columns, the seconds elapsed since midnight, day of the year and the year.  I am creating a timestamp of LabVIEW from these three numbers.  Of seconds elapsed since midnight, I can create seconds, minutes and hours.  If I feed in a cluster of time with the day of the year and the year, the timestamp of output is 0.  Does not work.  Although an input of the day of the year element, the Date and time with seconds function apparently requires day for months and months to work.

    The only solution I can imagine at this stage is to calculate the month and the day of the day of the year, which would imply a choice of the month table and a check of the leap year.

    Smart solutions, I'm missing?

    DaveT

    Dave,

    I found a Julian Georgian so far.

  • How to calculate the first day of the month following in BI Publisher

    I need to be able to calculate the first day of the month of a date field in a BI Publisher model. The field name is COL_CLM_180 and contains a date in the format "YYYY-MM-DD". I have found so far any documentation that still gives me an idea of what to do.

    Any help or advice would be appreciated

    Hi - thank you very much for your help. Your last answer got me going in the right direction and I indeed was dense. I don't know why I don't think to the calculation in the original query. I put the statement: TRUNC (ADD_MONTHS(A.COL_CLM_180,1), 'MM') in a column in the query of conduct and it has worked flawlessly. Thank you - thank you - thank you.

  • How to calculate the year last month in obiee 11g?

    Hello

    I want to calculate the year last month in obiee 11g. I tried DB.

    -SELECT TO_CHAR (ADD_MONTHS (SYSDATE,-12), 'YYYYMMDD') FROM DUAL;

    Using the above query, year last month is -"08-01-2015"

    But I want to get the same result using timestampadd() in obiee 11g.

    Please help me,

    Thanks in advance,

    A.Kavya

    Hello

    TIMESTAMPADD (SQL_TSI_YEAR-1, CURRENT_DATE)

  • How to calculate the percentage of monthly sales

    Hello

    I have a column sales of the month and I have another column that calculates (monthly sales / (total number of monthly sales)) * 100.

    How to calculate this percentage of sales.

    Please advice.

    Kind regards

    Séverine.

    You can use the AGGREGATE function for the TOTAL monthly sales in the year:

    Something like: AGGREGATE ("measure monthly sales" to "Time" ".") Time hierarchy ".» An »)

    Calculate your final formula:

    "measure the monthly sales" / AGGREGATE ("measure monthly sale 'to"time'." Time hierarchy ".» Year') * 100

  • to calculate the days of sheets each month

    Hi all

    I need a query which can get leaves from an employee of days each month.

    Example:

    1.

    If an employee has leave of date_start = 15 January 2014 ', date_end = 30 January 2014 "which is in the same month, then it will be"

    Duration = 15-30 + 1 = 16 days

    Total_days_in_jan = 31 days

    Calculation of salary leave will be amount = (: base +: housing) * (: duration) / (Total_days_in_jan)

    = (1000 + 2000) * 16/31

    ' 2. If his two month date_start = 15 January 2014 ', date_end = 10 February 2014.

    I wrote code that works perfect below

    If to_char(:date_start,'mm') = to_char(:date_end,'mm') then

    v_mon_days: = TO_CHAR (last_day (TO_DATE(:date_start,'DD-MON-YYYY')), 'DD');

    v_tot: = (nvl(:BASIC1,0) + nvl (:FUJ_LIVING,0)) *(:Duration_)/v_mon_days;

    elsif to_char(:date_start,'mm') <>to_char(:date_end,'mm') then

    v_mon_days_st_dt: = TO_CHAR (last_day(:date_start), 'DD');

    v_mon_days_en_dt: = TO_CHAR (last_day(:date_end), 'DD');

    v_lv_days_st_dt: = last_day(:date_start) -: date_start + 1;

    v_lv_days_en_dt: =: date_end - trunc(:date_end,'mm') + 1;

    v_tot_st_dt: = (nvl(:BASIC1,0) + nvl(:FUJ_LIVING,0)) * (v_lv_days_st_dt) / v_mon_days_st_dt;

    v_tot_en_dt: = (nvl(:BASIC1,0) + nvl(:FUJ_LIVING,0)) * (v_lv_days_en_dt) / v_mon_days_en_dt; 

    v_tot: = nvl(v_tot_st_dt,0) + nvl(v_tot_en_dt,0);

    end if;

    Return round (v_tot);

    3. If the 3 months off, say date_start = 24-may-2014 date_end = July 2, 2014.

    I need some help here... what happens if the 4 month also leave...

    Please suggest.

    Kind regards

    Afzal.

    Hi Roger, Etbin

    Thanks for your replies.

    I found the solution on the month to display between two dates.

    To calculate that I used the loop as below

    declare

    ST DATE: =: date_start;--TO_DATE('24-MAY-2014','DD-MON-YYYY');

    ED DATE: =: date_end;--TO_DATE('02-JUL-2014','DD-MON-YYYY');

    number of v_t_amount;

    CURSOR C1 IS

    SELECT more GRAND (ST, ADD_MONTHS (TRUNC (st, 'MONTH'), (LEVEL - 1))) dt.

    LESS (ed,

    LAST_DAY (ADD_MONTHS (TRUNC (st, 'MONTH'), (LEVEL - 1)))

    ) ld

    OF THE DOUBLE

    CONNECT BY LEVEL<>

    MONTHS_BETWEEN (TRUNC (ed, 'MONTH'), TRUNC (st, 'MONTH'))

    + 1

    ORDER BY 1;

    V_AMOUNT NUMBER: = 0;

    V_T_AMOUNT NUMBER: = 0;

    NUMBER OF V_DAYS;

    BEGIN

    FOR I IN C1 LOOP

    V_AMOUNT: = (nvl(:SALARY_DIFF,0) + nvl(:SPECIAL_ALLOWANCE,0) + nvl(:CF_OTHERS,0)

    + NVL(:Computer,0) + nvl(:PHONE_ALLOW,0) + nvl(:WORK_NATURAL,0)

    (+ nvl(:TRANSPORTATION,0) * (i.1d - i.dt + 1) / TO_CHAR (LAST_DAY (i.1d), 'dd'));

    V_T_AMOUNT: = V_AMOUNT;

    end loop;

    end if;

    dbms_output.put_line (v_t_amount);

    end;

  • How to calculate the number of days/weeks/months between 2 dates?

    Hello

    I would like to know how to calculate the number of days/weeks/months between 2 dates in OBIEE 11 g, for example, I have 26/05/2013 and 19/05/2013, then I want to get 7 days.

    Thank you!
    Jamie

    Hi Jamie,

    Through this links...

    http://www.bravesoft.com/blog/?p=682
    http://twobiee.blogspot.in/2012/01/working-with-date-differences.html

    Mark as correct it allows u...
    Thank you...

  • calculate a date field first of the month

    I need to calculate a date field using date of hire as a base date, and it should return the first of the month following 30 days of date of hire.  (date of rental + 30 days then first of the month following that date).

    Hello margery497,

    In this scenario, you can create a text field 1 with validation as a calculated field and can add now() formula inside. Then, in the text field 2, you can add the now() + 30 formula and save it with the calculated field.

    Here is the reference for validating field:

    http://helpx.Adobe.com/EchoSign/KB/form-fields---validations.html

    Kind regards

    -Usman

  • Calculate the average over the last 12 months

    Hello

    I am trying to calculate the average value per customer and per month from and including the month and 12 months back

    for example: 1 January 12 = average (agreed_rate) & (process_rate) average from February 1st, 11 'and 1st January 12'.
    February 1, 12 = average (agreed_rate) & (process_rate) average of 1 March 11 'and 1 February 12'
    March 1, 12 = average (agreed_rate) & (process_rate) average of 1 April 11 'and 1st March 12' etc.

    create table (test)
    cust_num varchar2 (5).
    month, date, time,
    number of agreed_rate
    number of process_rate);

    insert into test values ("A001", January 1, 11 ', 87, 65);
    insert into test values ("A001", February 1, 11 ', 56, 62);
    insert into test values ("A001", March 1, 11 ', 76, 88);
    insert into test values ("A001", April 1, 11 ', 45, 69);
    insert into test values ("A001", may 1, 11 ', 99, 65);
    insert into test values ("A001", June 1, 11 ', 98, 43);
    insert into test values ("A001", July 1, 11 ', 87, 70);
    insert into test values ("A001", August 1, 11 ', 43, 99);
    insert into test values (' A001', ' 01 - SEVEN.-11', 62, 32 ');
    insert into test values ("A001", October 1, 11 ' 89, 44);
    insert into test values ("A001", November 1, 11 ', 34, 65);
    insert into test values ("A001", December 1, 11 ', 87, 87);
    insert into test values ("A002", January 1, 12 ', 33, 65 ");
    insert into test values ("A002", February 1, 12 ', 56, 23 ");
    insert into test values ("A002', March 1, 12 ', 76, 46 '');
    insert into test values ("A002', April 1, 12 ', 67, 69");
    insert into test values ("A002', may 1, 12 ', 99, 33");
    insert into test values ("A002', June 1, 12 ' 89, 21");
    insert into test values ("A002', July 1, 12 ', 87, p. 77");
    insert into test values ("A002', August 1, 12 ', 69, 99");
    insert into test values ("A002', '' 01-SEP-12, 89, 32");
    insert into test values ("A002', October 1, 12 ', 43, 20");
    insert into test values ("A002', November 1, 12 ', 34, 56");
    insert into test values ("A002', December 1, 12 ', 77, 78");

    JAN-12 e.g. agreed_rate average = (33 + 87 + 34 + 89 + 62 + 43 + 87 + 98 + 99 + 45 + 76 + 56) / 12
    FEB-12 average agreed_rate = (56 + 33 + 87 + 34 + 89 + 62 + 43 + 87 + 98 + 99 + 45 + 76) / 12

    The results should be displayed per month (like the example above) and cust_num.

    Can anyone help?

    Thank you

    You must go to the current line, that is included as twelfths a form 11 months.
    If you round the result is 67,42 67,41 rather than. This is the result on all the cust_num.
    If you want to the result for each customer comment just the partiton of clause.

    SELECT      cust_num, month, agreed_rate
    ,      round (sum (agreed_rate) OVER ( --PARTITION BY  cust_num
                                    ORDER BY month
                       RANGE
                       INTERVAL '11' month
                       preceding
                       ) / 12,2) AS avg_agreed_rate
    FROM       test
    ORDER BY  month
    

    Partition on cust_num

    SELECT      cust_num, month, agreed_rate
    ,      round (sum (agreed_rate) OVER ( PARTITION BY  cust_num
                                    ORDER BY month
                       RANGE
                       INTERVAL '11' month
                       preceding
                       ) / 12,2) AS avg_agreed_rate
    FROM       test
    ORDER BY  month
    

    Published by: chris227 on 01.02.2013 01:51
    the corrected table name

    Published by: chris227 on 01.02.2013 01:52

  • calculate the last 5 months

    How to calculate the final 5 months of sysdate?

    Education - TO_CHAR(SYSDATE,'YYYYMM')-1 SELECT FROM DUAL gives 201300. The desired output is 201212, 201211, 201210, 201209 201208.

    Sanjay

    Try this

    select to_char(add_months(sysdate, -1), 'YYYYMM') from dual
    union
    select to_char(add_months(sysdate, -2), 'YYYYMM') from dual
    union
    select to_char(add_months(sysdate, -3), 'YYYYMM') from dual
    union
    select to_char(add_months(sysdate, -4), 'YYYYMM') from dual
    union
    select to_char(add_months(sysdate, -5), 'YYYYMM') from dual
    
  • How to calculate the number of Avg based on month

    Hi all

    I want to calculate Avg based on averages of the month

    Ex: i have made Total column
    current month like July Thn avg = total/7.
    then even report working in October than avg time = total/10.

    Any help.

    Thank you

    You must specify a digital for parameter 2. The Substring function takes the source from character string parameters and the length of the unit. In my example it will take the value of the variable current_month and returns the characters of the 8th position for 2 characters (so character 8 and 9). For example, instead of 'Time' happening. "" Month "you must pass the literal number 8. So I think the actual code you need is:

    SELECT "Applications and financial accounts. "" Value "/ CAST (SUBSTRING (VALUEOF ("CURRENT_MONTH") OF 8 TO 2) as INT)"financial accounts and Applications.

    NB I'm assuming that the value that you want to divide by the number of current month is called "Applications and financial accounts. "" Value ", please change it's column that you never use.

    Please mark it as useful to the answer

  • REQ: script to calculate the number of months

    Looking for a script that will calculate the number of months between 2 dates (to 2 decimal points)

    or if there is a way to make a calculation of the number of months

    for example: if I go to google and say 75 days - months, it returns a value of 2.46

    That's what I'm looking for

    If anyone can help?

    with a calculation of date or number calculation?

    I tried # days / 365 x 12 but there is no decimal places.  right guard rounded up/down

    As mentioned in a month, the days are not constant throughout the year and change formula 28-31 days. How are you calculating the decimal value of the month?

    A year has 365 days, if she did then there would be no need for leap years and centuries jump.

    Calculation of a variable with the result of a calculation method is set to decimal.

    cDateFormat = "d-mmm-yyyy";
    var cStartDate = "January 1, 2000;
    var oStartDate = util.scand (cDateFormat, cStartDate);
    oStartDate.setHours (0, 0, 0, 000);
    var cEndDate = "January 15, 2000;
    var oEndDate = util.scand (cDateFormat, cEndDate);
    oEndDate.setHours (0, 0, 0, 000);
    nDiff var = oEndDate.getTime () - oStartDate.getTime ();
    Console.println ("end date:" + cEndDate);
    Console.println ("start date:"+ cStartDate ");
    Console.println ("difference in milliseconds:" + nDiff);
    Console.println ("difference in seconds:" + nDiff/1000);
    Console.println ("difference in minutes:" + nDiff / (1000 * 60));
    Console.println ("difference in hours:" + nDiff / (1000 * 60 * 60));
    Console.println ("difference in days:" + nDiff / (1000 * 60 * 60 * 24));
    Console.println ("difference in weeks:" + nDiff / (1000 * 60 * 60 * 24 * 7));
    Console.println ("difference over the years:" + nDiff / (1000 * 60 * 60 * 24 * 365.2524));
    Console.println ("difference in months:" + nDiff / ((1000 * 60 * 60 * 24 * 365.2524) / 12));  12 months in a year;

    End date: January 15, 2000
    Start date: January 1, 2000
    Difference in milliseconds: 1209600000
    Difference in seconds: 1209600
    Difference in minutes: 20160
    Difference in hours: 336
    Difference in days: 14
    Difference of weeks: 2
    Difference in years: 0.0383296591617194
    Difference in months: 0.45995590994063273

    Several turncate the decimal values scirpts because keeping them may not meet the need of specific calculation. You know that there are methods to roud until the next iniger, round.5 to the top and turnacate to the lower intiger.

    According to the date of departure, the values may be different:

    For a start date of February 1, 2000, 75 days would be 1,810 months but for a start date of 1 February 2001 75 days becomes 1,838 since the number of days of changes of February 29 to 28 and the number of days for the month of fractions varies from 26 to 27.

  • Calculate the previous three months

    I want to calculate the past 3 months on the basis of sysdate in 3 separate columns. I get the previous month by executing the following SQL statement:
    select EXTRACT(MONTH FROM TRUNC(SYSDATE,'MONTH')-1)mn1 from dual
    The current month is July, then how can I get 05, 04 as output.

    Yogesh

    Hello

    Just remove TRUNC...

    select EXTRACT(MONTH FROM (SYSDATE))-1 mn1,EXTRACT(MONTH FROM (SYSDATE))-2 mn2,EXTRACT(MONTH FROM (SYSDATE))-3 mn3 from dual;
    

    AJ

Maybe you are looking for

  • Satellite U200 - 161 Fingerprint software does not not with IE7

    Looks like the ease of fingerprint to the record of the passwords working more once installed ie7 (final).All I have this problem or is it just me? Thank youNick

  • Pavilion p6-2002es: what is the minimap?

    My card mother TX H-CUPERTINO2-H61-uA, has a "mini-map taken." What is it? Can I plug an SSD there? I've been googleing cela but can't seem to get the difference between the 'PCI-e x 1' and the 'mini map making '.

  • charging problem air iPad

    I did not use my iPad in the last two months air. It has been turned off. Yesterday, when I tried to use it, it was not open and showing an empty battery. But it's not have charged. When I try to load my air of iPad, it shows the sign given in the fo

  • HP 15-r007tx blutooth drivers

    I'm having the problem with the installation of the blutooth driver I am using windows 7 64 bit operating system in Device Manager, it shows the yellow mark blooth controller the product is HP 15-r007tx

  • fminsearch error message

    When I try to use fminsearch, I get the error message "LabVIEW: the given name does not match a knowledge function, variable, or symbol." For example, I defined a function 'testfn' by a m-file called "testfn.m" containing funtion z = testfn(x,y) z =