Cross Column Calculation

Deal All,
Assalam-o-Alikum,
I have following table
MY_TABLE (c1 number(5), c2 number(5));
and the data inserted in this format
C1 C2
20
10
30
12
81
80
35
now I want to write the query that give the following result
C1 C2
--- ---- ------comments for understanding-- not required to show in QUERY
20 --remain same show 20
10 30 ----Previous value of c2 and current value of C1 column 10
30 900 -- Previous calculated value 30 * current value of C1 column 30
12 10800 ---Previous calculated value 900 * current value of C1 column 12
81 874800 --- Previous calculated value 10800 * current value of C1 column 81
80 69984000 --- Previous calculated value 874800 * current value of C1 column 80
35 2449440000 --- Previous calculated value 69984000 * current value of C1 column 35
Please Remember that I don't want to CREATE any Database Function to show the result. I want to solve it in SQL Query with help of Default Oracle Function or without default Oracle function its up to you.
Thanks
Farrukh Shaikh

select *
from MY_TABLE
model
dimension by(rownum rn)
measures(c1,c2)
rules(
c2[1]=c1[1],
c2[2]=c1[1]+c1[2],
c2[rn > 2] order by rn = c2[cv()-1]*c1[cv()]);

Similar Messages

  • Extra column calculation

    New user........
    I am trying to make a third column calculation based on columns 'Uncommitted Stcok' and 'Committed Stock' but it is not working, can anyone help me understand this simple task?
    SELECT Top 20 T0.Father AS 'Parent Code', T2.ItemName AS 'Parent Description', T0.Code AS 'Child Code', T1.ItemName AS 'Child Description', T0.Comment, T1.OnHand AS 'Uncommitted Stock', T1.IsCommited AS 'Committed Stock', T2.FrgnName AS 'Status'
    FROM ITT1 T0  INNER JOIN OITM T1 ON T0.Code = T1.ItemCode INNER JOIN OITM T2 ON T0.Father = T2.ItemCode
    ORDER BY T0.Father, T0.Code
    Also, I will need to join OITW to this report but have no idea how to join a 3rd table..........
    Thanks,
    Robin

    Hi Robin,
    Welcome you to the forum.
    You may try this:
    SELECT Top 20 T0.Father AS 'Parent Code', T2.ItemName AS 'Parent Description', T0.Code AS 'Child Code', T1.ItemName AS 'Child Description', T0.Comment, T1.OnHand AS 'Uncommitted Stock', T1.IsCommited AS 'Committed Stock', T1.OnHand -T1.IsCommited AS 'Available', T2.FrgnName AS 'Status'
    FROM ITT1 T0 INNER JOIN OITM T1 ON T0.Code = T1.ItemCode INNER JOIN OITM T2 ON T0.Father = T2.ItemCode
    ORDER BY T0.Father, T0.Code
    As for join OITW, you need to specify one warehouse. Is default warehouse for the item ok?
    Thanks,
    Gordon

  • Cross Tab calculation in Individual column-Crystal Report

    Hi experts
    I am preparing a report in Crystal report 2008. Report template is Cross Tab.
    Structure of report is
    Cardname-Row, DocType-Columnd, DocTotal-Summarize field.
    Result of this report is
                          IN(Invoice)             RC(Incoming Payment)      Total
    XYZ                    1000                  -500                                 500
    ABC                    2000                 -1000                               1000
    Total                   3000                  -1500                               1500
    I have inserted a column using calculated member. I want to Calculate in that column with BP opening balance
    eg. OCRD.Balance-DocTotal when I do this it give first value to all column rows, i.e (consider XYZ opng Balance is 1500, I have calculate month opening balance which meance Current Opening Balance-Current month Order bookings=Month opening balance)
              IN(Invoice)             RC(Inc Pmt)      Total   Opng Balance
    XYZ       1000                  -500                  500     500
    ABC      2000                 -1000                1000     500
    Total      3000                  -1500                1500    500
    I want to calculate Opng Balance for each CardName but it gives first Customers opning balance to all customers.
    Give me solution.
    Thanks in Advance

    Hi
    I think you can do calculation based on the formula .On the cross tab ,there is :
    X -selection - row
    Y - selection -column
    Z - summary
    You can also use formula on cross tab to do that function  and insert into summary section .
    Hope this helps .
    Bishal

  • How to do column calculation in smartforms using table

    Hi,
    In Smartform Table..I created main area ( as TABLE) having  columns 
    POSNR(CELL7),   MATNR(CELL8),  FKIMG(CELL9),  VRKME(CELL10),  UPRICE(CELL11),  NETWR(CELL12)....
    Here UPRICE--- Calculate this field as Unit price = Amount / Billed Qty.
    For this....I created a Flow Logic at CELL11
    CELL11(Right click)
    CREATE---FLOW LOGIC -
    PROGRAM LINE
    Provided code:
    UPRICE = WA-NETWR / WA-FKIMG.
    Its showing the run time error
    Reference field WA-NETWR unknown in form
    what i have to do now for calculating UPRICE in this case...
    <offer removed by moderator>
    Thanks
    Lohit
    Edited by: Thomas Zloch on Jan 11, 2011 11:36 AM

    retreived the five column ( POSNR MATNR FKIMG VRKME NETWR )  values by providing code in GLOBAL SETTINGS -- INITIALISATION (TAB)
    SELECT POSNR MATNR FKIMG VRKME NETWR  INTO CORRESPONDING FIELDS OF TABLE
       ITAB FROM VBRP WHERE VBELN EQ PVBELN.
    And in  MAIN AREA-----Table -
    DATA (Tab) provided
    Loop
    Internal Table   ITAB  TO  WA.
    Created Text at each cell as
    WA-POSNR(for Cell 7),
    WA-MATNR (for Cell 8),
    WA-FKIMG(for CELL9),
    WA-VRKME(for Cell 10),
    UPRICE(for Cell 11),
    WA-NETWR(for Cell 12)

  • Column calculations getting wrong will exporting report to excel

    Hi Experts,
    we have a report on obiee 11.1.1.5.0 with following details
    we have report with columns destination region,service , origin country and revenue
    and report is created as follows
    Destination Region
    Asia NorthAmerica Total(using selection steps included both country)
    June July June July June July
    Origin
    Country
    India 25% 75% 50% 50% 37.5% 62.5%
    China 96% 4% 96% 4% 96% 4%
    Brazil 78% 22% 72% 28% 75% 25%
    the logic i have used here is :- i have revenue and in pivot have applied SHOW DATA AS PERCENT OF LAYER(DESTINATION GEOGRAPHY)
    till here everything is fine but when i export it to excel then i get this all values divided by 100 for eg:-
    Destination Region
    Asia NorthAmerica Total(using selection steps included both country)
    June July June July June July
    Origin
    Country
    India 0.25% 0.75% 0.50% 0.50% 0.375% 0.625%
    China 0.96% 0.4% 0.96% 0.4% 0.96% 0.4%
    Brazil 0.78% 0.22% 0.72% 0.28% 0.75% 0.25%
    any suggestions how to get rid of this problem

    Ankit,
    Did you check this?
    Calculated Percentage Columns in Pivot Table loose formating in Excel
    Regards,
    Dpka

  • Reuse column calculations

    In my query I have a lot of columns that are a result of complicated calculations, some of the columns can be computed as a result of other columns.
    My question is without creating a nested SQL can I refer to column alias so that I don't have to specify the same calculation twice.
    Below is a simplified example of what I am trying to do where the column alias num2 and num21 are simplified examples of the calculations
    I need to perform. The first query below works fine but I have to specify my calculation (num *2) twice.
    select num * 2 num2, (num *2) + 1 num21 from
    (select 2 num from dual)
    I would like to somehow refer the num2 alias in my second column as shown below. (so that (num * 2) is speicified only once) But I get a SQL error saying the num2 idenitifer is not valid.
    select num * 2 num2, num2 + 1 from
    (select 2 num from dual)

    Why do you think there's a performance hit?
    The dual table is not referenced twice in your 2nd query - just because there is an outer query does not mean that the table is referenced more than once! Oracle is more than capable of rewriting the query. Did you even bother to check the explain plan of both queries?
    SQL> select (2*2) num2, (2*2) + 1 from dual;
          NUM2    (2*2)+1
             4          5
    1 row selected.
    Execution Plan
       0      SELECT STATEMENT Optimizer=ALL_ROWS (Cost=5 Card=1)
       1    0   FAST DUAL (Cost=5 Card=1)
    Statistics
              0  recursive calls
              0  db block gets
              0  consistent gets
              0  physical reads
              0  redo size
            257  bytes sent via SQL*Net to client
            276  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              1  rows processed
    SQL> select num2, num2 +1 from (select 2*2 num2 from dual);
          NUM2     NUM2+1
             4          5
    1 row selected.
    Execution Plan
       0      SELECT STATEMENT Optimizer=ALL_ROWS (Cost=5 Card=1)
       1    0   FAST DUAL (Cost=5 Card=1)
    Statistics
              0  recursive calls
              0  db block gets
              0  consistent gets
              0  physical reads
              0  redo size
            256  bytes sent via SQL*Net to client
            276  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              1  rows processedOh look... both exactly the same!

  • Line alignment cross columns and spacing issue

    Hi All,
    I am using CC to do article layout for a scholarly journal and have 3 questions:
    1. I have a hard time to always align text lines across two columns on the same page. For body text, I use 9.5 point, automatic leading which is 11.4.  I have different levels of subheadings which have different spacing (before and after paragraph) specification. they all use auto leading. Since htere are so many variables, what are the principles for getting main text lines aligned across columns, for example, what do I need to set fixed first, what next?
    2. The 2nd question is if I have two levels of headings (each has space before and after) together, how to ask ID not to add too much space between the two headings?
    3. Probably this is the same question as #2: For some paragraph which has both space before and after, if the next paragraph has the same style as the one in front it, no space is needed between the two. How to do this?
    thank you very much in advance for your help!
    Eric

    "2. "Ask" ID? The spacing before and after a paragraph is defined in the style options. If you have, for example, first heading level 1, then heading level and want them to have less space, you could either decrease after spacing of level 1 or before spacing of level 2. If you have the other situation, with "level 1, then text" or "level 2, then text", you may adjust spacing on the text style only, so the text would always have the same spacing before itself, no matter if level 1 or level 2 is above. "
    Thank you guys for replying. So you cannot specify in style to ask ID to automatically adjust space for situations like two different levels of headings together, and you have to do that manually?

  • Cross column radio group solution using dynamically generated HTML

    I am tasked with creating a screen in Apex matching look and feel of an existing application screen; tabular form, multiple column radio buttons to update a single column value (radio group needs to be row oriented, across multiple columns). I could not find a way to use HTMLDB_ITEM.RADIO_GROUP () function for this due to the radio group being column based, great as a row selector but not for use across columns (each button being a column).
    My first thought was to comprise and use checkboxes via HTMLDB_ITEM.CHECKBOX () for the multiple choices (in each column) and HTMLDB_ITEM.HIDDEN() to hold the chosen value, a JavaScript function for “onClick” event to make the checkboxes in one row act like radio buttons in a radio group. I created a simple application to show the concepts of my solutions …
    SQL looks like this:
    select pk_id, -- f01
    object_to_color, -- f02
    HTMLDB_ITEM.CHECKBOX(11, color_choice,
    'onClick="chkboxAction('||pk_id||', document.wwv_flow.f11, ''RED'')"', 'RED') red,
    HTMLDB_ITEM.CHECKBOX(12, color_choice,
    'onClick="chkboxAction('||pk_id||', document.wwv_flow.f12, ''BLUE'')"', 'BLUE') blue,
    HTMLDB_ITEM.CHECKBOX(13, color_choice,
    'onClick="chkboxAction('||pk_id||', document.wwv_flow.f13, ''GREEN'')"', 'GREEN') green,
    color_choice -- f03
    from objects_to_color
    Columns pk_id and color_choice are set as Show off and Display As Hidden. Note that my HTMLDB_ITEM.CHECKBOX items start with id number 11 (f11 – f13) so as not to conflict with the item id’s Apex will generate on it’s own. I could have used HTMLDB_ITEM functions to create all items and had my own PL/Sql update process.
    This creates a tabular presentation with a column for each color choice as a checkbox, shown checked if that color is initially set.
    The JavaScript function chkboxAction() clears the other checkboxes if a color is selected and stores the color in the hidden item db column for use in Apex Submit processing. Sorry the identation get's lost in the post!
    function chkboxAction (id, ckbx, color) {
    // f01 is pk_id (hidden)
    // f11 is RED checkbox
    // f12 is BLUE checkbox
    // f13 is GREEN checkbox
    // f03 db column color_choice for update (hidden)
    var idx;
    // Find row index using pk_id passed in as id argument.
    for (var i=0; i < document.wwv_flow.f01.length; i++) {
    if (document.wwv_flow.f01.value == id) {
    idx = i;
    i = document.wwv_flow.f01.length;
    if (ckbx(idx).checked == true) {
    // Set hidden color_choice column value to be used in update.
    document.wwv_flow.f03(idx).value = color;
    // Uncheck them all, then reset the one chosen.
    document.wwv_flow.f11(idx).checked = false;
    document.wwv_flow.f12(idx).checked = false;
    document.wwv_flow.f13(idx).checked = false;
    ckbx(idx).checked = true;
    } else {
    // Unchecked so clear color_choice column value to be used in update.
    document.wwv_flow.f03(idx).value = '';
    This works well and, as an aside, has an added feature that the color can be “unchosen” by unchecking a checked checkbox and leaving all checkboxes unchecked. This cannot be done with radio buttons unless a radio button is added as “no color”.
    But what if radio buttons must be used, as in my situation? Here is another solution using custom code to dynamically generate radio buttons for a row based radio group rather than using HTMLDB_ITEM.RADIO_GROUP ().
    select pk_id, -- f01
    object_to_color, -- f02
    '<input type="radio" name="rb'||pk_id||'" id="rb'||pk_id||'_1" value="RED" '||
    decode(color_choice, 'RED', 'CHECKED', '')||
    ' onClick="rbAction('||pk_id||', ''RED'')">' red,
    '<input type="radio" name="rb'||pk_id||'" id="rb'||pk_id||'_2" value="BLUE" '||
    decode(color_choice, 'BLUE', 'CHECKED', '')||
    ' onClick="rbAction('||pk_id||', ''BLUE'')">' blue,
    '<input type="radio" name="rb'||pk_id||'" id="rb'||pk_id||'_3" value="GREEN" '||
    decode(color_choice, 'GREEN', 'CHECKED', '')||
    ' onClick="rbAction('||pk_id||', ''GREEN'')">' green,
    color_choice -- f03
    from objects_to_color
    The pk_id column is used here to ensure a unique name and unique id for the items. In practice a custom api should be used to generate items in this way.
    The JavaScript function is actually simpler for radio buttons because the radio group handles the mutually exclusive logic for choosing a color.
    function rbAction (id, color) {
    // f01 is pk_id (hidden)
    // f03 db column color_choice for update (hidden)
    var idx;
    // Find row index using evaluation_question_id.
    for (var i=0; i < document.wwv_flow.f01.length; i++) {
    if (document.wwv_flow.f01.value == id) {
    idx = i;
    i = document.wwv_flow.f01.length;
    // Set hidden result column referenced in update.
    document.wwv_flow.f03(idx).value = color;
    Now the problem is that on update, Apex will be confused by the custom items and try to post updated values to it’s own internal items – which don’t exist. The result is the very frustrating HTTP 404 - File not found error when apex/wwv_flow.accept executes on Submit. So, the trick is to clear the custom items prior to the update with a simple JavaScript function, then the values show again when the page is rerendered, if you are not branching from the page. The Submit button is changed to call the following function:
    function submit () {
    var items = document.getElementsByTagName("INPUT");
    for (i=0; i< items.length; i++) {
    if (items(i).type == "radio") {
    if (items(i).checked == true)
    items(i).checked = false;
    doSubmit('SUBMIT');
    This technique might have general use when using custom items. Comments or improvements on this?
    See Oracle Apex site: workspace SISK01, app OBJECTS_TO_COLOR

    Just the code for formatting.
    Checkboxes to behave like radio group ...
    SQL ...
    select pk_id,              -- f01
           object_to_color,    -- f02
              HTMLDB_ITEM.CHECKBOX(11, color_choice,
                  'onClick="chkboxAction('||pk_id||', document.wwv_flow.f11, ''RED'')"', 'RED') red,
              HTMLDB_ITEM.CHECKBOX(12, color_choice,
                  'onClick="chkboxAction('||pk_id||', document.wwv_flow.f12, ''BLUE'')"', 'BLUE') blue,
              HTMLDB_ITEM.CHECKBOX(13, color_choice,
                  'onClick="chkboxAction('||pk_id||', document.wwv_flow.f13, ''GREEN'')"', 'GREEN') green,
           color_choice  -- f03
    from objects_to_colorJavaScript ...
    function chkboxAction (id, ckbx, color) {
        // f01 is pk_id (hidden)
        // f11 is RED checkbox
        // f12 is BLUE checkbox
        // f13 is GREEN checkbox
        // f03 db column color_choice for update (hidden)
        var idx;
        // Find row index using pk_id passed in as id argument.
        for (var i=0; i < document.wwv_flow.f01.length; i++) {
           if (document.wwv_flow.f01(i).value == id) {
              idx = i;
              i = document.wwv_flow.f01.length;
        if (ckbx(idx).checked == true) {
          //  Set hidden color_choice column value to be used in update.
          document.wwv_flow.f03(idx).value = color;
          // Uncheck them all, then reset the one chosen.
          document.wwv_flow.f11(idx).checked = false;
          document.wwv_flow.f12(idx).checked = false;
          document.wwv_flow.f13(idx).checked = false;
          ckbx(idx).checked = true;
        } else {
          //  Unchecked so clear color_choice column value to be used in update.
          document.wwv_flow.f03(idx).value = '';
    }Radio button solution ...
    SQL ...
    select pk_id,              -- f01
           object_to_color,    -- f02
           '<input type="radio" name="rb'||pk_id||'" id="rb'||pk_id||'_1" value="RED" '||
                decode(color_choice, 'RED', 'CHECKED', '')||
                ' onClick="rbAction('||pk_id||', ''RED'')">' red,
           '<input type="radio" name="rb'||pk_id||'" id="rb'||pk_id||'_2" value="BLUE" '||
               decode(color_choice, 'BLUE', 'CHECKED', '')||
               ' onClick="rbAction('||pk_id||', ''BLUE'')">' blue,
           '<input type="radio" name="rb'||pk_id||'" id="rb'||pk_id||'_3" value="GREEN" '||
               decode(color_choice, 'GREEN', 'CHECKED', '')||
               ' onClick="rbAction('||pk_id||', ''GREEN'')">' green,
           color_choice  -- f03
    from objects_to_colorJavaScript ...
    function rbAction (id, color) {
        // f01 is pk_id (hidden)
        // f03 db column color_choice for update (hidden)
         var idx;
         // Find row index using evaluation_question_id.
        for (var i=0; i < document.wwv_flow.f01.length; i++) {
           if (document.wwv_flow.f01(i).value == id) {
              idx = i;
              i = document.wwv_flow.f01.length;
        //  Set hidden result column referenced in update.
        document.wwv_flow.f03(idx).value = color;
    function submit () {
      // Clears radio buttons to prevent Apex trying to post and causing page error.
      var items = document.getElementsByTagName("INPUT");
      for (i=0; i< items.length; i++) {
        if (items(i).type == "radio") {
          if (items(i).checked == true)
            items(i).checked = false;
      doSubmit('SUBMIT');
    }

  • Problem logical column calculation

    Hi,
    I've a logical table with 2 datasources DS1 and DS2 with this definition
    DS1: Physical table TABLE_A, where condition: TABLE_A.A_YEAR = EXTRACT(YEAR FROM CURRENT_DATE)
    DS2: Physical table TABLE_A, where condition: TABLE_A.A_YEAR = EXTRACT(YEAR FROM CURRENT_DATE) - 1
    Columns:
    Field1: DS1.VAL1
    Field2: DS2.VAL1
    Field3 CASE WHEN EXTRACT(MONTH FROM CURRENT_DATE) > 11 THEN DS1.VAL1 ELSE DS2.VAL1
    Showing Field1 and Field2 in Answers is showing the correct value, but Field3 is always the value of DS1.VAL1.
    Having a look in the properties of the field, there's written for "Data Type derives from physical sources:" the following:
    "case when extract(month from DATE '2008-10-15') > 10 then sum(TABLE_A.VAL1) else sum(TABLE_A.VAL1) end"
    So there's nothing shown that my returned columns have different logical data sources ...
    What do I have to do to get the correct value.
    Thanks
    chrissy

    Hi user649490,
    this was only an example and so a typing error ...
    Because the month is extracted in condition I have to do it for all month ...
    Otherwise I shave found my error ... I copied datasource one and thought I unmapped all columns, mapped by first datasource. Having again a look into the column mapping I recognized, that the columns where double mapped by datasource 1 and 2. I changed this and it's working fine now ...
    So sorry for bothering you with my stupidness :-)
    chrissy

  • How is liability relieved column calculated in Account Payables.

    Hello all,
    I am unable to find the exact definition of Liability relieved. How is it calculated in "Payables Posted Payment Register" report in Account payables module in oracle r12?. I know that its amount of the liability that is relieved after you have done a payment. But not sure, whether its payment amount in invoice exchange rate or its payment amount in payment's exchange rate.
    Any help in this regard would be helpful.
    Thanks,
    Upendra

    Upendra
    It should be directly taking the conversion rate stored in the SLA. Can you take a look at one payment's accounting and see what the conversion rate and conversion date it used to store the entry the liability is relieved? Report should show the same.
    Thanks
    Nagamohan

  • Optimisation of cross dimensional calculations

    Hi,
    Here's a script which should not take too long to run. However, this script runs for hours. Any suggestions would be great. I have added some more details about the dimensions involved.
    Outline of the script:
    /*Script Begins*/
    SET UPDATECALC OFF;
    SET CREATENONMISSINGBLK ON;
    SET CACHE ALL;
    SET CALCPARALLEL 5;
    SET CALCTASKDIMS 2;
    SET NOTICE LOW;
    SET MSG SUMMARY;
    FIX (@ATTRIBUTE("Existing"),@Relative("Location",0),@RELATIVE("Entity",0),&pln_scenario,"BU Budget",&plan1_yr,@RELATIVE("BOM",0), @RELATIVE("YearTotal",0))
    "RMQ" = "location wise Sales Volume"->"UBOM" * "RMQ per Unit SKU"->"All locations"->"YearAgg";
    ENDFIX;
    ENDFIX;
    /*Script Ends*/
    UBOM is a member of BOM, "YearAgg" is a dummy member in period dimension and "all locations" is a dummy member in location dimension.
    Dimension details: Evaluation Order which has been thought through.
    Dimension Members Density
    Account 352 Dense
    Period 35 Dense
    Version 3 Sparse
    Scenario 8 Sparse
    Location 7 Sparse
    Year 9 Sparse
    Entity 20 Sparse
    Product 416 Sparse
    BOM 938 Sparse

    Are you sure that changing the cross-dimensional order of members makes a difference?
    "location wise Sales Volume"->"UBOM" * "RMQ per Unit SKU"->"YearAgg"->"All locations";instead of
    "location wise Sales Volume"->"UBOM" * "RMQ per Unit SKU"->"All locations"->"YearAgg"really improves how Essbase reads its index and page files?
    It seems to me that Essbase is pointing to the same block, no matter the order of the dimension combinations.
    The same goes for a FIX: I can't see how the dimension order within a single FIX statement is going to cause Essbase to touch blocks differently as it will be the same list of blocks (and cells) however it's combined.
    Have you benchmarked the cross-dimensional member order? I'd be really interested to hear re any differences in performance.
    Regards,
    Cameron Lackpour

  • Nested IF/AND/OR in Calculated Measure/Column

    I have the following problem, which I couldn't quite solve in Excel and was wondering whether it can be done in PowerPivot (I failed so far):
    A datasheet with a column "HOUR" and another column "AM/PM". Entries in the first column consist of 1,2,3,4,5,6,7,8,9,10,11, or 12, the second column consists of 'AM's or 'PM's. Together they define the time of an incident (regarding the
    below problem, note that I am not allowed to create a new column in the source datasheet or change existing columns). The below formulas 1.) to 3.) work excellent in Excel for getting '1's or '0's for incidents that happened either between 8AM and 4PM, or
    outside of this time window, as long as I create a new column somewhere in the source datasheet.
    1.) =IF(AND(A1>=8, A1<=11),IF(B1="AM",1,0),0) + IF(AND(A1>=1, A1<=4),IF(B1="PM",1,0),0) + IF(AND(A1=12),IF(B1="PM",1,0),0)
    2.) =--OR(AND(A1>=8, B1="AM", A1<>12), AND(OR(A1<=4, A1=12), B1="PM"))
    3.) =--OR(AND(OR(A1={8,9,10,11}),B1="AM"), AND(OR(A1={1,2,3,4,12}), B1="PM"))
    However, I wanted the "1"s to be summarized - without creating an extra column - as calculated field in a pivot table in Excel. As it turned out, the calculated field option in Excel's standard Pivot table doesn't allow such complex formulas.
    Someone then told me to try PowerPivot. However, the calculated column/calculated measure option in the PowerPivot sheet (once I loaded my data) doesn't seem to support the above formulas either.
    The column headers have the same names as I described above. However, some symbols were not accepted so the relevant ones read now: "[HOUR]", "[AM PM]".
    I tried:
    =IF(AND([HOUR]>=8, [HOUR]<=11),IF([AM PM]="AM",1,0),0) + IF(AND([HOUR]>=1, [HOUR]<=4),IF([AM PM]="PM",1,0),0) + IF(AND([HOUR]=12),IF([AM PM]="PM",1,0),0)
    Error: "Too few arguments were passed to the AND function. The minimum argument count for the function is 2."
    =OR(AND([HOUR]>=8,[AM PM]="AM",[HOUR]<>12), AND(OR([HOUR]<=4,[HOUR]=12),[AM PM]="PM"))
    Error: "Too many arguments were passed to the AND function. The maximum argument count for the function is 2."
    Does anybody know how to translate any of the above formulas into one PowerPivot accepts? or, alternatively, any other way how to achieve the desired results? Thank you for any help on this.

    Hi Natrajx,
    The first of your formulas can be translated into the follow DAX syntax that can be used to define a Calculated Column:
    IF(
    table1[HOUR] >= 8 && table1[HOUR] <= 11,
    IF(
    [AM PM] = "AM",
    1,
    0
    0
    +
    IF(
    table1[HOUR] >= 1 && table1[HOUR] <= 4,
    IF(
    [AM PM] = "PM",
    1,
    0
    0
    +
    IF(
    table1[HOUR] = 12,
    IF(
    [AM PM] = "PM",
    1,
    0
    0
    You could also created a Calculated Field based on similar logic using the following formula:
    SUMX(
    'Table1',IF(
    table1[HOUR] >= 8 && table1[HOUR] <= 11,
    IF(
    [AM PM] = "AM",
    1,
    0
    0
    +
    IF(
    table1[HOUR] >= 1 && table1[HOUR] <= 4,
    IF(
    [AM PM] = "PM",
    1,
    0
    0
    +
    IF(
    table1[HOUR] = 12,
    IF(
    [AM PM] = "PM",
    1,
    0
    0
    Note the use of "&&" instead of the AND() function. In DAX, the AND() and OR() functions only support a maximum of 2 arguments. You can use "&&" for the AND operation and "||" for the OR operation. Hopefully
    the DAX examples above will help you to see how it can be applied to your scenario.
    Regards,
    Michael Amadi
    Please use the 'Mark as answer' link to mark a post that answers your question. If you find a reply helpful, please remember to vote it as helpful :)
    Website: http://www.nimblelearn.com
    Blog: http://www.nimblelearn.com/blog
    Twitter: @nimblelearn

  • Calculating YTD column in OBIEE 11g

    Hi ,
    Here is my requirement :
    I have to create a report , which shows several measure values (revenue , gross mergin etc as rows of a pivot table) against a certain period (Months , i.e. Jan , Feb ....etc as columns of a pivot table ) . Taking period prompt as presentation variable prompt . For example , If 'Jan' is selected from period dropdown list ,then only Jan values are shown . I am able to do upto this part .
    Next , I have to add one YTD column (calculated ) , which will eventually sum the values of upto selected period value , i.e if selected month is 'Mar' then March values will be shown in one column and 'Jan + Feb + Mar ' values will shown in another .
    How to achive this ?
    FYI , I am taking essbase 11.1.2.0 as datasource and using OBIEE 11.1.1.5.0 version .
    Thanks in advance.
    Edited by: 937268 on Jul 2, 2012 3:04 PM

    Hi,
    by using time series Ago function method and also by suing obiee-date-expression method you can solve it.
    YTD:
    http://download.oracle.com/docs/cd/E21764_01/bi.1111/e10540/dimensions.htm#i1023744
    http://gerardnico.com/wiki/dat/obiee/function_time
    http://www.vlamis.com/blog/2011/6/17/doing-time-series-calculations-in-answers-11g.html
    OBIEE - date expression method
    http://obieedue.blogspot.com/2011/06/obiee-date-expressions-reference.html
    Thanks
    Deva

  • Store the result of the column in variable in answer

    Hi All,
    Is there a way to store the value of the result of the column of the report and use that value in calculation in another report. I need to get the grandtotal value which changed according to the prompt and want to use that grand total value to calculate new column in another report. Can we use presentation variable? I want to store the total value 30 and then calculate the region percentage. I am not able to store the total value and create the new column calculation using the total value.
    Region 1 10 *0.33*
    Region 2 20 *0.67*
    Total 30
    Thanks,
    Virat
    Edited by: 872073 on Jan 9, 2013 6:30 AM

    You can use this Report as a Subreport in the Final Report,and apply a filter the column=subreport.columnvalue.

  • Cross Conditional format in Pivot Table

    Hi Guys
    I have an important client requirement where by I need to present the data in teh following format
    CAMBODIA LAOS SRI LANKA
    KPI_NAME PROPOSED_TARGET_VALUE MIN_TARGET_VALUE Aug-09 Sep-09 Oct-09 Aug-09 Sep-09 Oct-09 Aug-09 Sep-09 Oct-09
    SERVICES PROVISIONING CALL RATE (%) <5% <5% 21.00% 68.00% 10.80% 1.300% 0.100% 1200.% 2.500% 5.000% 66.50%
    The table is like that :
         Measure     Indicator
    13     38     White
    17     1016     Red Green
    15     3456     White
    19     8644     Grey
    12     41605.886     White
    10     52647.007     White
    This is possible only through pivot table whereby country and period dimesions have been put in pivot.
    Also there is a requirement to paint the background colour in Red Amber Green ... and for that I ahve to create a new column where after comparing i can put the status as Red ..Amber ..Green and based on the cross column conditional formating I can paint the fact value like 21.00% (shown above) .
    But when I am importing that table in pivot view all the backgrounf colour vanishes. since cross column conditional formating is not supported in pivot.
    Is there any way out to achieve this requirement .
    Thanks

    http://oraclebizint.wordpress.com/2008/04/29/oracle-bi-ee-101332-conditional-formatting-based-on-multiple-character-columns-in-a-pivot-table/

Maybe you are looking for

  • Importing songs from a protected CD

    Is there any way to import songs from copyright protected physical CDs into my itunes library? The songs will upload to Windows Media Player, but will not convert to AAC in itunes. Sometimes, when I insert a copyright protected CD into my drive, noth

  • Visio 2013 Ribbon not visible

    I have installed Visio Professional 2013 on a Windows 7 Pro Virtual  Machine (Apple OS 10.9.2 as the host, VMWare Fusion 4.1.4). Needless to say, all software is genuine :-).  When I open Visio, the  startup screen is simply dark grey. The various do

  • Ok, one more time i need help...

    ok, i've got my class program running properly... just need some help with the test program... i need this to print out the name of a card when the user is prompted to type one in... for example the user types in "8H" and it would print out "8 of hea

  • ODS/ODSSM schema creation

    We have been working with OIAM 11g for a few years now with great success.  This is our first install on Centos6.4 and it's on AWS. We have never had an issue running the installs and having ODS or ODSSM get created, but this time on CentOS 6.4 -- an

  • Aggregates: 3.5 vs. 7.0

    Hi all, In terms of aggregates, has anything changed in 7.0? Cheers Gerrit