Logical Agregated Column with formula

Hi all,
I need to create an agregated column of a field that have a formula. I know you haven't understood anything so here is an example :)
Source Table:
A B C
001 'ZZ' 'ZZ'
001 'ZZ' 'ZZ'
001 'ZZ' 'YY'
002 'XX' 'TT'
003 'JJ' 'JJ'
Desired Result: (E is--> SUM(CASE WHEN B=C THEN 1 ELSE 0 END)) )
D E
001 2
002 0
003 1
What I have tried:
In the Business Model, I created a column with the option: "Use existing logical columns as the source" where I typed the formula: SUM(CASE WHEN B=C THEN 1 ELSE 0 END)), that rises the following error: "State: S1000. Código: 10058. [NQODBC] [SQL_STATE: S1000] [nQSError: 10058] A general error has occurred. [nQSError: 22019] Function Sum does not support non-numeric types. (S1000)".
I changed the formula adding CAST operators for 1 and 0 to be INT but it didn't work.
* Creating the column "E" in Answers with the formula -->SUM(CASE WHEN B=C THEN 1 ELSE 0 END)) works but I would like to have "E" already in the repository.
Thanks in advance.

Use (CASE WHEN B=C THEN 1 ELSE 0 END) using physically mapped columns and not through "Use existing logical columns as the source".
Then specify sum as aggragation rule.

Similar Messages

  • How do  I duplicate row or column with formulas?

    I've never been a big spreadsheet user but I recall being able to intuitively (the only time ever with a MS product) find a way to duplicate a row or column in Excel so that it would replicate the same formulas as the row/column immediately adjacent to it. Can this be done with Numbers?
    Example: Say I've got a row that has values across with a Sum Total cell and an Average cell calculated with formulas. I'd like to add other rows below so they inherit the same formulas (referencing cells in the new rows). I'm already getting irritated just thinking about having to assign formulas over and over again with each new row.
    I hope I'm just missing something obvious.
    CA

    There is a duplicate command under the Edit Menu item. The short cut is the apple key and "D". However, I have the trial copy and it is grayed out. Meaning it is not working. I have my bought copy arriving next week. Hope this is not grayed out in the bought version. This is a deal breaker. I use this command all the time. They need to fix this right away.

  • How to pass prompt value to columns with formula?

    Hello guys
    I have a situation:
    I have a report with 1 column name 'product' and in this column it has a case statement like 'case when item is ('a','b','c','d') then 'Men' else 'women' end'
    Then I have created a dashboard prompt of the exact same column, and I defined the same case statement in the prompt's column formula as the same.. Then I tested the prompt and it is returning only 2 values 'men', 'women'..
    However, when putting the prompt and report on the same dashboard, the report is not accepting the prompt values..
    Then I set the presentation variable on the prompt and call it 'Product', then in the report I created a filter on 'product' column as equal to presentation variable 'product'--- I tried with and without single quotes.. So the filter itself looks like : case when ...... is equal to / is in @{product}
    However, when I then return back to the dashboard, I am getting the error:
    State: HY000. Code: 388918336. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 27005] Unresolved column: "Product". (HY000)
    Could anyone help?
    Thanks

    Hola
    is possible that are you using a BINS agrupation into the Column Formula?
    if you form a CASE statement using a Bins agrupation, in the column Formula, this must be disabled to match statements between columns and DB Prompt
    if you are using a BINS agrupation to form the CASE statement, you have to delete the bins agrupation in the Column but keep the CASE statement
    Regards

  • New column with formula in Report Painter - GRR2

    Hi gurus,
    I want to insert a new element in my new report painter created by GRR2. I took a standard report and I copied the report.  I know how to insert a new element.
    The problem is I want to choose the value of a field in PROJ table for create a formula in my report. The users insert a value in user-define fields of CJ20n, and i would like to choose this value for create a formula in my report.
    Can I create a formula to take this value from the table PROJ? If I need to create a characteristic for choose this field, as I can create?
    Thanks.

    Hi,
    My question is:
    Can i pick a value of a table (proj) for use in formula of report painter??
    Many thanks.
    Regards.

  • How to make table column with formula

    Hi all..
    This is my class
    public class MyNumber{
         private int num;
         public int getNum(){
              return num;
         public void setNum( int num){
              this.num = num;
    }Consider I design a table with FXML editor ( Scene Builder in this case )
    and these are some of my codes
    private TableView tab;
    private TableColumn<MyNumber, Integer> tabColInput;
    private TableColumn tabColOutput;
    tab.setEditable(true);
    tabColInput.setEditable(true);
    tabColInput.setCellValueFactory( new PropertyValueFactory<Person,Integer>("num") );
    tabColInput.setCellFactory(TextFieldTableCell.forTableColumn());
    tabColInput.setOnEditCommit(
        new EventHandler<CellEditEvent<MyNumber, Integer>>() {
            @Override
            public void handle(CellEditEvent<MyNumber, Integer> t) {
                ((MyNumber) t.getTableView().getItems().get(
                    t.getTablePosition().getRow())
                    ).setNum(t.getNewValue());
    );Problem:
    I want to make tabColOutput to always show the result for tabColInput times 2
    eg:
    When I change a row in tabColInput to 10, tabColOutput will show 20
    When I change a row in tabColInput to 3, tabColOutput will show 6
    Could anyone advice me how to do this?
    Ps: I am not english native speaker, so I am sorry if I am saying it wrong ^^

    I just give it a try and it works like magic
    Here is how I do it (change a cell from a table by code)
    import java.util.ArrayList;
    import java.util.List;
    import javafx.application.Application;
    import javafx.collections.FXCollections;
    import javafx.collections.ObservableList;
    import javafx.geometry.Insets;
    import javafx.scene.Group;
    import javafx.scene.Scene;
    import javafx.scene.control.Label;
    import javafx.scene.control.TableColumn;
    import javafx.scene.control.TableView;
    import javafx.scene.control.cell.PropertyValueFactory;
    import javafx.scene.layout.VBox;
    import javafx.scene.text.Font;
    import javafx.stage.Stage;
    public class TableViewSample extends Application {
        public static final String Column1MapKey = "A";
        public static final String Column2MapKey = "B";
        public static void main(String[] args) {
            launch(args);
        @Override
        public void start(Stage stage) {
            List<MyTableData> listData = new ArrayList<MyTableData>();
            listData.add(new MyTableData("A", 21) );
            listData.add(new MyTableData("B", 24) );
            listData.add(new MyTableData("C", 23) );
            listData.add(new MyTableData("D", 21) );
            listData.add(new MyTableData("E", 22) );
            ObservableList<MyTableData> tableData = FXCollections.observableArrayList(listData);
            Scene scene = new Scene(new Group());
            stage.setTitle("Table View Sample");
            stage.setWidth(300);
            stage.setHeight(500);
            final Label label = new Label("Student IDs");
            label.setFont(new Font("Arial", 20));
            TableColumn<MyTableData, String> firstDataColumn = new TableColumn<MyTableData, String>("NAME");
            TableColumn<MyTableData, Integer> secondDataColumn = new TableColumn<MyTableData, Integer>("AGE");
            firstDataColumn.setCellValueFactory(new PropertyValueFactory<MyTableData, String>("name"));
    //        firstDataColumn.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<MyTableData, String>, ObservableValue<String>>(){
    //            @Override
    //            public ObservableValue<String> call(CellDataFeatures<MyTableData, String> p) {
    //                return p.getValue().nameProperty();
            firstDataColumn.setMinWidth(130);
            secondDataColumn.setCellValueFactory(new PropertyValueFactory<MyTableData, Integer>("age"));
            secondDataColumn.setMinWidth(130);
            TableView<MyTableData> table_view = new TableView<MyTableData>();
            table_view.setItems(tableData);
            table_view.getColumns().setAll(firstDataColumn, secondDataColumn);
            final VBox vbox = new VBox();
            vbox.setSpacing(5);
            vbox.setPadding(new Insets(10, 0, 0, 10));
            vbox.getChildren().addAll(label, table_view);
            ((Group) scene.getRoot()).getChildren().addAll(vbox);
            stage.setScene(scene);
            stage.show();
            //(this is where I change my table content with code)
            tableData.get(0).setName("xx Gargoyle xx");
            System.out.println("Testing Done");
    import javafx.beans.property.SimpleStringProperty;
    import javafx.beans.property.StringProperty;
    public class MyTableData{
        private final SimpleStringProperty name;
        private int age;
        public MyTableData(String name, int age) {
            this.name = new SimpleStringProperty(name);
            this.age = age;
        public String getName() {
            return name.get();
        public StringProperty nameProperty(){
            return name;
        public void setName(String name) {
            this.name.set(name);
        public int getAge() {
            return age;
        public void setAge(int age) {
            this.age = age;
    }And thank you very much

  • OBIEE 10g - Logical column with static value

    I created a logical column with static numeric value in it and added it to presentation layer. The column is not showing up in Answers. All other columns I added are showing up. The issue is with this one only.
    I have verified permissions on this column in presentation layer. I tried reloading server metadata in answers, restarting all services but it didn't help.
    One thing I noticed this column is showing fx icon instead of Σ icon.

    Kid,
    The fx means it is a calculated column/formula and the sigma means that you've added some aggregation type to the column.
    Either way it shouldn't matter and your column should be showing up.
    I would attempt to create a new column and in the fx field try entering static text and see if that allows the column to be visible after dragging it to the presentation layer subject area.
    Also what is the value that you are adding?

  • Create a logical column with more than one data source

    I'm having a problem to create a logical column with more than one data source in Siebel 7.8.
    What I want to do is the union of 2 physical tables in one logical table.
    For example, I have a "local_clients" table and a "abroad_clients" table. What I want is to have a logical table "clients" with the client data from the 2 tables.
    What I've tried is dragging the datasources I need onto the logical column.
    However this isn't working because it only retrieves the data from the first data source.

    Hi!
    I think it is not possible to do this just by dragging the columns to the logical table. A logical table can have more than one source, but I think each column must have just one direct source column.
    I'm not sure, but maybe you should do the UNION SQL to get the data of the two tables. In the physical layer, when you create a new physical table, it's possible to set the "table type" as a "SELECT". I didn't try that, but it seems that it's possible to have the union table in the physical layer.
    Bye.
    Message was edited by:
    user578388

  • HT3354 How do i create a column with a percentage formula

    Im really struggling creating a line of columns with different formulas.
    colin

    The title of your post and the text of your post sound like two different questions. One is about creating a column of percentages and the other is about a "line of columns with different formulas".  Neither gives enough information about the problem for anyone to provide a good answer, unless we guess at what you are asking. Here is my guess:
    If B2 has a number in it and C2 has the formula =B2*5%, C2 will be 5% of B2. If you copy/paste or fill-down that formula to the rest of the column, C3 will be 5% of B3, C4 will be 5% of B4, etc.
    I have no idea what "a line of columns with different formulas" means so I'm not going to hazard a guess.

  • Table with a column with RANK formula does not sort properly

    Hello,
    I have a table in excel with Rank function that reference another column with numerical values. The results in the column (called Rank) with rank function are as expected but Sorting (ascending or descending) doesn't
    work as expected on the column .  The Rank gets sorted in the following order: 1,15, 2,19, 8 , 4......
    Few things that I've verified are:
    1. Verified that there are no text values in the column.
    2. Tried changing the format to number but this still doesn't resolve the sort issue.
    3. Copied the values from the Rank column to a different sheet and applying sort works as expected.
    Does anyone have any idea on what could be wrong? Appreciate your help!
    Thanks!

    Resolved the issue. I had an incorrect formula in one of the that was referenced by the Rank column.

  • Suppress Missing Data not work in web form with formula column inside

    Dear All,
    I've a planning web form with formula column inside to calculate the variance and % variance. But missing cell can't be suppressed, although I've checked the 'Suppress Missing Blocks' and 'Suppress Missing Data' options.
    Anyone have face the same problem..?? and how to fixed it..??
    thanks.
    Regards,
    VieN

    There is a known issue that sounds like the problem you are experiencing
    10358200 - If a formula column exists in a data form, selecting the Suppress missing option does not hide rows that do not contain data.
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • BW 3.5 - Issue with formula variable with replacement path

    Dear experts,
    I'm facing an issue with formula variable with replacement path.
    Just to clarify, I know replacement paths is raising a lot of questions but I've been using this functionnality extensively in the past, both in 7.0 and 3.5, so I'm not looking for basic information about how to use it.
    I'm trying to setup a simple report that would show total values per plant of Purchase Order < 100 €
    To do so I've setup a calculated key figure as follow:
    VAR1 * ("PO value" < 100 ) * "PO value"
    VAR1 is a formula variable with replacement path on 'purchase order' and value attribute 'constant =1'.
    (The report has to show values summarized by plant but should not show the detail PO by PO, so I'm not looking at a solution based on condition)
    The report as characteristic "plant" in rows and my CKF in columns.
    Now let's take an example. I have 3 POs in Plant 1:
    PO1 -> 150€
    PO2 -> 90€
    PO3 -> 80€
    Because of the variable with replacement path, the result in my query should be:
    plant1 = 170 (even though characteristic "purchase order" is not in my rows, system should evaluate PO one by one and return values only for those two that are below 100).
    But the result coming is 320, which is wrong.
    I've done the same report on many other 3.5 systems and it worked perfectly, and I am not able to get proper support from SAP OSS who keep saying that this functionnality is not ready in 3.5 (although I've provided screenshot of this working on another 3.5 system!!! how frustrating...)
    They have also pointed to problems of Before and After aggregation but that has absolutely no impact. Once again, the scenario is working perfectly on other 3.5 systems with the same query design, so i'm sure it has nothing to do with Query Designer options.
    Would anyone have ever come to an equivalenet problem? I'm wondering whether the DB itself could not play a role in the variable with ref  characteristic 'constant =1' ...
    Any though is welcome!
    thanks

    Hi,
    The text variable is replaced when the exact date is clear for this key figure column according to the restriction.
    To achive this, please make sure that either the variable is directly restricted in the key figure selection, or that the date characteristic is in drilldown.
    Regards,
    Patricia

  • Issue with formula collision

    Hello Experts,
    I am facing an issue with Formula collision, below is an expample
    My requirement is to use Column formula for the value (????) in the below table.
                                  Restriction (C1)     Restriction (C2)     Formula(C1-C2)
    Restriction (R1)     4              2                                 2
    Restriction (R2)     8              3                                 5
    Formula(R1+R2)     12              5                              ????
    I have tried using the below settings
    1) Formula(R1+R2)  "Standard"
    2) Formula(C1-C2)  " Use result of this formula"
    But still getting row formula being used, please advice.
    Thanks,

    Select the Formula which you created Formula(C1-C2)
    In the properties tab Go to Calculations--> Select the Check Box Cumulated
    In the Drop Down for Calculation Direction Select --> Calculate Along Columns
    If you require you can also select the Check Box Also Apply to Results
    Hope it Helps.
    rgds, Ghuru

  • How to prevent duplication on a column with condition

    Hello everyone,
    I need some advice here. At work, we have an Oracle APEX app that allow user to add new records with the automatic increment decision number based on year and group name.
    Says if they add the first record , group name AA, for year 2012, they get decision number AA 1 2013 as their displayed record casein the report page.
    The second record of AA in 2013 will be AA 2 2013.
    If they add about 20 records , it will be AA 20 2013.
    The first record for 2014 will be AA 1 2014.
    However, recently , we get a user complaint about two records from the same group name have the same decision number.
    When I looked into the history table, and find that the time gap between 2 record is just about 0.1 seconds.
    Besides, we have lookup table that allows admin user to update the Start Sequence number with the restraint that it has to be larger than the max number of the current group name of the current year.
    This Start sequence number and group name is stored together in a table.
    And in some other special case,user can add a duplicate decision number for related record. (this is a new function)
    The current procedure logic to add new record on the application are
    _Get max(decision_number) from record table with chosen Group Name and current year.
    _insert into the record table the new entered record with decision number + 1
    _ update sequence number to the just added decision number.
    So rather than utitlising APEX built-in automatic table modification process, I write a procedure that combine all the three process.
    I run some for loop to continuously execute this procedure, and it seems it can autotically generate new unique decision number with time gap about 0.1 second.
    However, when I increase the number of entry to 200, and let two users run 100 each.
    If the time gap is about 0.01 second, Duplicate decision numbers appear.
    What can I do to prevent the duplication ?
    I cannot just apply a unique constraint here even for all three columns with condition, as it can have duplicate value in some special condition. I don't know much about using lock and its impact.
    This is the content of my procedure
    create or replace
    PROCEDURE        add_new_case(
      --ID just use the trigger
      p_case_title IN varchar2,
      p_year IN varchar2,
      p_group_name IN VARCHAR2,
      --decisionnumber here
      p_case_file_number IN VARCHAR2,
      --active
      p_user IN VARCHAR2
    AS
      default_value NUMBER;
        caseCount NUMBER;
      seqNumber NUMBER;
      previousDecisionNumber NUMBER;
    BEGIN
      --execute immediate q'[alter session set nls_date_format='dd/mm/yyyy']';
      SELECT count(*)
            INTO caseCount
            FROM CASE_RECORD
            WHERE GROUP_ABBR = p_group_name
            AND to_number(to_char(create_date, 'yyyy')) = to_number(to_char(date_utils.get_current_date, 'yyyy'));
            SELECT max(decision_number)
            INTO previousDecisionNumber
            FROM CASE_RECORD
            WHERE GROUP_ABBR = p_group_name
            AND to_number(to_char(create_date, 'yyyy')) = to_number(to_char(date_utils.get_current_date, 'yyyy'));
            IF p_group_name IS NULL
            THEN seqNumber := 0;
            ELSE   
            SELECT seq_number INTO seqNumber FROM GROUP_LOOKUP WHERE ABBREVATION = p_group_name;
            END IF;
        IF caseCount > 0 THEN
               default_value := greatest(seqNumber, previousdecisionnumber)+1;
        ELSE
               default_value := 1;
        END IF; 
      INSERT INTO CASE_RECORD(case_title, decision_year, GROUP_ABBR, decision_number, case_file_number, active_yn, created_by, create_date)
      VALUES(p_case_title, p_year, p_group_name, default_value, p_case_file_number, 'Y', p_user, sysdate );
      --Need to update sequence here also
      UPDATE GROUP_LOOKUP
      SET SEQ_NUMBER = default_value
      WHERE ABBREVATION = p_group_name;
      COMMIT;
    EXCEPTION
    WHEN OTHERS THEN
        logger.error(p_message_text => SQLERRM
                    ,p_message_code => SQLCODE
                    ,p_stack_trace  => dbms_utility.format_error_backtrace
        RAISE;
    END;
    Many thanks in advance,
    Ann

    Why not using a sequence for populating the decision_number column ?
    Sequence values are guaranteed to be unique so there's no need to lock anything.
    You'll inevitably have gaps and no different groups will have the same decision_number in common.
    Having to deal with consecutive numbers fixations you can proceed as
    with
    case_record as
    (select 2012 decision_year,'AA' group_abbr,1 decision_number from dual union all
    select 2012,'BB',2 from dual union all
    select 2012,'AA',21 from dual union all
    select 2012,'AA',22 from dual union all
    select 2012,'BB',25 from dual union all
    select 2013,'CC',33 from dual union all
    select 2013,'CC',34 from dual union all
    select 2013,'CC',36 from dual union all
    select 2013,'BB',37 from dual union all
    select 2013,'AA',38 from dual union all
    select 2013,'AA',39 from dual union all
    select 2013,'BB',41 from dual union all
    select 2013,'AA',42 from dual union all
    select 2013,'AA',43 from dual union all
    select 2013,'BB',45 from dual
    select decision_year,
           group_abbr,
           row_number() over (partition by decision_year,group_abbr order by decision_number) decision_number,
           decision_number sequence_number -- not shown (noone needs to know you're using a sequence)
      from case_record
    order by decision_year,group_abbr,decision_number
    DECISION_YEAR
    GROUP_ABBR
    DECISION_NUMBER
    SEQUENCE_NUMBER
    2012
    AA
    1
    1
    2012
    AA
    2
    21
    2012
    AA
    3
    22
    2012
    BB
    1
    2
    2012
    BB
    2
    25
    2013
    AA
    1
    38
    2013
    AA
    2
    39
    2013
    AA
    3
    42
    2013
    AA
    4
    43
    2013
    BB
    1
    37
    2013
    BB
    2
    41
    2013
    BB
    3
    45
    2013
    CC
    1
    33
    2013
    CC
    2
    34
    2013
    CC
    3
    36
    for retrieval (assuming decision_year,group_abbr,decision_number as being the key):
    select decision_year,group_abbr,decision_number -- the rest of columns
      from (select decision_year,
                   group_abbr,
    -- the rest of columns
                   row_number() over (partition by decision_year,group_abbr order by decision_number) decision_number
              from case_record
             where decision_year = :decision_year
               and group_abbr = :group_abbr
    where decision_number = :decision_number
    DECISION_YEAR
    GROUP_ABBR
    DECISION_NUMBER
    2013
    AA
    4
    if that's acceptable
    Regards
    Etbin

  • One Key FIgure in more than one column with different restrictions

    Hi,
      I am using a key figure in more than one column with different restrictions, but restriction in one column is affecting the result in other column. What shall i do to make it independent from one another??

    Hi Pravender Chauhan,
        If you want in Single column different value for different Rows based on same Key Figure, you can create Structure where you can define different logic for each row but using same key figure.
    If you want to use different Key figures then you should have to Restricted Key Figure and for any calculation you can use calculated Key figure.
    Assign points if Useful.
    Regards,
    Rajdeep.

  • Get the month from a date column with the calculated column

    I am trying to get the month from a date field with the help of calculated column. However I get this syntax error whenever I want to submit the formula:
    Error 
    The formula contains a syntax error or is not supported. 
    the default language of our site is German and [datum, von] is a date field.

    Hi,
    I have created two columns
    Current MM-YY
    Calculated (calculation based on other columns)
    Today
    Date and Time
    Current MM-YY is calculated value with formula as
    =TEXT(Today,"mmmm")
    But the output shows as December instead of May.
    I have tried =TEXT([Datum, von];"mmmm") but no help.
    I am trying to populated the column automatically with current month..ex: if its May the field should show May, next month it should show June an so on.
    Any kind help is grateful.
    Regards,
    Pradeep

Maybe you are looking for

  • When I plug in my iPhone 4S into my computer the iTunes program doesn't open.  Only the Music iTunes opens

    I have not synced my iPhone for some months.  When I plugged it into my computer the iTunes program does not launch.  There is an iTunes icon installed but this only opens as a Music/video program.  There is no side panel where I select my device, ac

  • Unable to insert properly the text in a already existing file

    Hi Everyone, I am trying to read and write the text file using randomaccess class. When i am trying to update a line with string its over writing next line with the same number of bytes as my string which i am trying to insert. For example if my text

  • Full site link code to override mobile redirect in Adobe Muse

    Hi - I've set up a desktop and mobile site in Muse.  I allow Muse to generate the code that automatically goes to either the desktop or mobile version depending on which type of device the user is using. On the mobile version I have a simple "welcome

  • Slow internet using Time Capsule

    Hi! I have a Time Capsule and are experiencing problems with the WiFi speed. There's nothing wrong with my internet connection because when i plug in the internet caple straight into the computer I get great speed all the time. The Time Capsule is pl

  • Making VLC the default application

    Hello, I know this may not be the correct forum, but I was hoping someone could let me know how I can change MPEG Streamclip from being my default video app. I am not sure how it was chosen but it cannot play WMV or other file types whereas VLC can p