Calculate Column Subtotal in  Attribute View

Hi,
Is it possible to calculate the Column subtotal in Caluclation View itself likethe way we do in ALV.
I want to do this calculation in the Calculation View itself.
I thought of doing that through  Calculated Column but the SQL Function SUM() doesn't work there.
Below is how my Calculation View looks like:
I want the output to be like this (Highlighted in Green):
I am getting the field Allocation from my Attrbute View ZAT_VBRK_VBRP(Join of table VBRK and VBRP) and ZVBAK is just an attribute view for VBRK.
Thanks,
Gaurav

Hi Shankar,
Sub_totals can be achieved through the SQL query using the Grouping_sets which is something like this,
select col_1, col_2, col_3, sum(col_4)
from <Table_name>
group by grouping sets LIMIT 2 WITH SUBTOTAL
((col_1, col_2),(col_3));
Usually this can be done in the front end reporting tool but,If you want to continue with the calculation_view where you want the sub total to be appended as a "New Tuple" then you will have to go with the CE_Functions using the sql_query.
This is something new that i can learn today, lets see how the experts will guide us with the approach.
Regards,
Krishna.

Similar Messages

  • Duplicate columns created in attribute view

    Hi
    I created an attribute view as shown in the video Creating an attribute view | SAP HANA using the data given. After creating the attribute view as per the video, when I preview the data in the attribute view, I see that all the columns are created twice. For instance there is Company Name and Company Name 1, Contact_Name and Contact_Name1, ContactTitle and ContactTitle1 and so on. This has happened for all the fields.
    I checked the table in the schema to see if there are duplicate fields there. But the DIMSupplier table in the STS schema has no duplicate fields.
    What I want to know is how were these duplicate fields created in this attribute view and how do I remove them? I checked the output fields and there also there are no duplicate fields.
    When I right click on the attribute view and select data preview, and then under the tab "Distinct Values" I can see all these duplicate field names. I am trying to delete these duplicate field names but I am getting an error message that the field you are trying to delete is being used elsewhere hence it cannot be delete.
    Can anyone please advise how to fix this error.
    Thank you.
    Regards,
    Pavan.

    Hi Anjali,
    Thanks a lot for your reply. But in my data foundation STS_ATTRIBUTE_VIEW, I do not see any duplicate columns to remove them. Today I see a warning and also I am unable to right click on the attribute view.
    The warning is given below:
    Message :
      STS.STS_ATTRIBUTE_VIEW: one or more columns of Table: DIMSUPPLIER have invalid ABAP name
    But in the Data Foundation in the Output tab under Columns I do not have any duplicate columns listed.
    Also the attribute view is in grey color. Its not in green color even after clicking on Save and Validate and SAve and Activate.
    I select the attribute view and hit on the data preview button. There in the Analysis tab under Available objects under String folder I can see all these duplicate column names. I right click on the duplicate column names and I see the options "Distinct Values", "Add to labels", values, filters and "Properties". Having selected the column name I hit on the delete button on my keyboard but nothing happened.
    Is this because of the warning that I am getting. What does this warning mean?
    Please advise.
    Thank you.
    Regards,
    Pavan.

  • How to calculate the total of a calculated column in a list view at the end of the view?

    I have a view with the following columns ProductName, Quantity, Price, Total The total column is a calculated column which is the product of quantity and price. I want to place the sum of the total column by the end of the list view. I can do this with
    the price and quantity but not with the total column. how do I do this?

    You can use SharePoint Designer and calculate the total in xslt view. Refer to the following post for more information
    http://community.bamboosolutions.com/blogs/bambooteamblog/archive/2009/04/24/how-to-total-calculated-columns-in-a-sharepoint-list.aspx
    http://blog.metrostarsystems.com/2012/12/03/jennys-sharepoint-tip-sum-calculated-columns/
    Cheers,

  • Unable to view columns for attribute views created

    Hi all,
    Here are the list of errors I am facing while creating attribute views and while adding multiple dimensions (Product dim and Employee dim) to an attribute view.
    I am unable to activate my attribute view. I don’t get any error message other than:
    Message :      STS.STS_ATTRIBUTE_VIEW: one or more columns of Table: DIMSUPPLIER have invalid ABAP name
    2. When I added DIM.Product attribute to the attribute view STS_ATTRIBUTE_VIEW, I am unable to see any column names for the DIM.Product to add them to output fields. Same with employee dimension also. Now my question is, Can I add more than one dimension to the same attribute view or do I have to create a new attribute view for every dimension. While I think I can add more dimensions to the same attribute view but I asked this question because I am unable to see any columns listed out in the dimensins Product and Employee.
    3. In Employee dimension when I click on the data preview, I don’t get any data. Its all blank. But there is data in the table and its visible when I preview in table.
    4. When I right click on the attribute view or the attribute itself I don't see any other options other than "Configure Table" but I remember 2 days back when I worked I was able to see other options like "Data Preview" and few others.
    Why am I unable to view the columns of the Product and Employee dimensions? Should there be a common primary key between all the dimensions to be able to view the data in the attribute view?
    Please note that my attribute view is still in grey inspite of hitting on save and validate and save and activate several times. And I am getting a warning message, "Some services are not started" on my hdbsystem and the system is showing yellow colour.
    Please advise.
    Thank you.
    Regards,
    Pavan.

    Hi Pavan,
    To much words and no picture, this doesn't help you to obtain community feedback.
    Can you sintetize your question, maybe even split it in minor questions.
    I confess I failled to understand what you are facing.
    Regards, Fernando Da Rós

  • Calculate Column using COUNT on an Attribute

    Can we do COUNT on Attribute in an Analytic View ?
    Ex:  Count("CARTYPE")
    CARTYPE values : ("SE,LE,XE, etc...)
    Thanks

    I am assuming you want to see the count as a field/column within the analytic view itself.
    If so take a look at note 1791464 as it will show you how you can invoke the built-in row.count of an analytic view.

  • Error while creating Attribute View

    When I try to get Attribute view through two joined table with same type join indices I get following error ;
    Could not execute 'CREATE COLUMN VIEW "_SYS_BIC"."MyDB/TEAM_EVENT" TYPE JOIN WITH PARAMETERS ( joinIndex = ...' in 112 ms 159 µs . SAP DBTech JDBC: [2048]: column store error: logical index creation error:  [2434] join index inconsistent;object=MyDB/TEAM_EVENTen
    I tried everyhing in mind but cannot solve the problem. Any idea ?

    Try
    CREATE OR REPLACE VIEW rdr_le_info_view
    AS
    SELECT l.strategic_le
    ,cun.ucn cunucn
    ,cun.date
    ,cccs.ucn ucn
    ,cccs.agr_num
    FROM strat_le l
    ,ucn_name cun
    ,customer_setup cccs
    ,cccs.run_num run_num
    WHERE l.gfa_until_dt = '31-dec-9999'
    AND l.glas_until_dt = '31-dec-9999'
    AND l.int_until_dt = '31-dec-9999'
    AND cccs.ucn_lead_office = cun.ucn
    AND cun.OID = l.client_oid;Then call it like:
    select *
    from rdr_le_info_view
    where run_num = v_run_num;

  • Dax Calculate column even when there is no record at a date

    We are creating a powerpivot model based on a table with data about worktasks of our employees.
    This is simplified our input:
    Tasknr date started dateended
    1 20140101 20140201 (yyyymmdd)
    2 20140102 20140103
    3 20140104 20140108
    Etc
    We created two measures to calculate how many tasks are opened and closed per day. That was no problem, but now the tricky part. We also want to know each day how many tasks are
    still open, even on days that no tasks are opened (or closed).
    My approach was to create a calculated column to determine how many tasks are opened up to that date and subtracted the closed tasks and end up with the tasks that are open. That
    seems to be working :
    =COUNTROWS(FILTER(Tasks; Tasks[Open]<=EARLIER(Tasks[Open]))) - COUNTROWS(FILTER(Tasks; Tasks[Close]<=EARLIER(Tasks[Open])))
    When I load this to the excel pivot I end up with this:
    Row Labels| Opened | Closed | Open not finished
    1/1/2014
            1         
    0          1
    1/2/2014        
    1          0         
    2
    1/3/2014
            0         
    1         0
    1/4/2014
            1         
    0         2
    The line with 1/3/2014 should have 1 in the column [opened not finished], but because that calculation is linked to the opendate column, not to the closed and 3/1/2014 no task
    was opened, there is no value. On days that no tasks are opened or closed there even is no line at all although there could be tasks that are still open.
    I need a mechanism that calculates the value even when there are no records
    on a particular day. Our users want to be able to view the results on any date they select.
    I have considered a second table with all the dates and calculate columns from the task-table but are there other ways to do this? I searched this forum but did not find an answer
    so far.

    Hi Jacob,
    In our company we have a standard date table that is included in all of our models. What I didn't want to do in this case was to extend that table with calculated fields to solve this issue. Alternative was to create a new date table with the calculated
    fields I needed. But I don't like that also so what I did was rewrite the sql that loaded the data into the pivot so that the measures were calculated at the load. But I am also not happy with that solution because of maintanance and performance reasons. My
    feeling is that there must be a way to solve this with only dax in the loaded table.
    Jacob's answer does exactly what you want. The DAX expression in his response is a measure which you could put in your Tasks table. You don't need to alter your date dimension in any way.
    The key to this technique is that the date table cannot have an active relationship to your Tasks table. (although you could have an inactive relationship and then you could use the USERELATIONSHIP function to make other measures easier to calculate)
    Translating Jocob's measure into something against a 'Tasks' table would looks like the following:
    =
    CALCULATE (
    COUNTROWS ( Tasks ),
    FILTER (
    Tasks,
    Tasks[Open] <= MAX ( Calendar[Date] )
    && Tasks[Closed] >= MAX ( Calendar[Date] )
    http://darren.gosbell.com - please mark correct answers

  • Consume Attribute view in Trial

    Hi there,
    I'm testing the Trial version of SAP HANA Cloud and wanted to create and consume an attribute view.
    I have created a very simple view which uses a table from the EPMSAMPLEDATA schema.
    Because of the isolation requirements I've executed the following SQL as mentioned here:
    CALL "HCP"."HCP_GRANT_SELECT_ON_ACTIVATED_OBJECTS"
    Now, the _SYS_BIC schema is visivle and I can find my View there. But when I right-click on my view and click on "Open content" I get an authorization error:
    Could not execute 'SELECT * FROM "_SYS_BIC"."p1234trial.myhanaxs/ATT_VIEW"' SAP DBTech JDBC: [2048]: column store error: search table error: [2950] user is not authorized.SAP DBTech JDBC: [2048]: column store error: search table error: [2950] user is not authorized
    Do I miss something or has something changed?
    Thanks for any help,
    ben

    Hi Priya,
    thanks for your answer.
    As logon user I'm using the username/password which is given to you after you've established the database tunnel via the "neo open-db-tunnel" command.
    Regarding to the other priviliges:
    Which user do I have to assign which priviliges?
    As I undestood from this tutorial there is no need to assign specific priviliges.
    Greets,
    ben

  • Filter in Attribute view

    I basically want to have a view that displays two columns from my table, but not have any of the columns repeat the same ID or Name
    For example if table data looked like this 
    Name ID
    John 204
    John 204
    John204
    Mel 205
    Mel 205
    Mary 205
    I want the View to display
    Name ID
    John 204
    Mel 205
    Mary 206
    I feel as though there is a real easy solution to this but I'm not sure how to do it.
    Thanks,
    Connor

    Hi,
    It will depends on ur data modelling.. and the logic
    mainly 3 views
    Attribute view  - consists of dimension or master tables
    analytical view - along with attribute view or some master tables it will have  fact table or transaction table table (basically a numeric or measure column presenting in a table)
    Calculation view - based on ur logic u can choose graphical/ complex -scripting methods...
    (Graphical, scripting)
    but in each step u should check the data integrity # no records retrieved are correct or not.., because in ur table if u r having composite relationships then data may go for looping especially when u r using analytical view..
    so for simple architecture or aggregation columns u can go for analytical view
    i enclosed  file in which it explains the modeling structure on what purpose we need to use the 3 types of view..
    hope this will help you.
    Thanks,
    Thara

  • Insufficient privilege when Activating an attribute view (person responsible for package = SYSTEM)

    Insufficient privilege when Activating an attribute view (person responsible for package = SYSTEM)
    SAP HANA Studio
    Version: 1.0.33
    Build id: 201206301604 (363996)
    Playing with the efashion tutorial with HANA Studio.
    I am SYSTEM user by default when starting the studio.
    -Schema created
    -DDL created
    -Data loaded
    -Attribute views created
    Below an extract of the error log:
    <info>Create Attribute View failed: SQL: transaction rolled back by an internal error: insufficient privilege: Not authorized

    Hello Anooj and Sri,
    Thank you for your answers, I really appreciate your inputs.
    So I executed this:
    "GRANT SELECT ON SCHEMA SYSTEM TO _SYS_REPO WITH GRANT OPTION;"
    Under the Studio SQL GUI and I still have the same error when activating my very simple attribute view.
    I have installed a recent HANA + Studio + Client release on my laptop:
      SAP HANA Studio
    Version: 1.0.33
    Build id: 201207050531 (364183)
    And yes, this is a demo and yes I am logged as the SYSTEM user (default user when stating the studio). For now, I dont know how to connect to another user with the studio and I will search the doumentation.
    Below a copy/past of the error msg.
    Internal deployment of object failed;Repository: Encountered an error in repository runtime extension;Internal Error:Deploy Attribute View: SQL: transaction rolled back by an internal error: insufficient privilege: Not authorized (ptime/query/plan_executor/ddl/qx_cube.cc:1514) n
    Create view DDL statement: CREATE COLUMN VIEW "_SYS_BIC"."efashion/ATV_OUTLET_LOOKUP" TYPE JOIN WITH PARAMETERS ( joinIndex = "EFASHION_TUTORIAL"."OUTLET_LOOKUP", joinIndexType = 0, viewAttribute = ('SHOP_ID', "EFASHION_TUTORIAL"."OUTLET_LOOKUP", "SHOP_ID", '', 'default', 'attribute', '', 'efashion/ATV_OUTLET_LOOKUP$SHOP_ID'), viewAttribute = ('SHOP_NAME', "EFASHION_TUTORIAL"."OUTLET_LOOKUP", "SHOP_NAME", '', 'default', 'attribute', '', 'efashion/ATV_OUTLET_LOOKUP$SHOP_NAME'), viewAttribute = ('MANAGER', "EFASHION_TUTORIAL"."OUTLET_LOOKUP", "MANAGER", '', 'default', 'attribute', '', 'efashion/ATV_OUTLET_LOOKUP$MANAGER'), viewAttribute = ('ZIP_CODE', "EFASHION_TUTORIAL"."OUTLET_LOOKUP", "ZIP_CODE", '', 'default', 'attribute', '', 'efashion/ATV_OUTLET_LOOKUP$ZIP_CODE'), viewAttribute = ('CITY', "EFASHION_TUTORIAL"."OUTLET_LOOKUP", "CITY", '', 'default', 'attribute', '', 'efashion/ATV_OUTLET_LOOKUP$CITY'), view = ('V_OUTLET_LOOKUP', "EFASHION_TUTORIAL"."OUTLET_LOOKUP"), defaultView = 'V_OUTLET_LOOKUP', 'REGISTERVIEWFORAPCHECK' = '1' )nVersion: 48n
    Thank you.
    Patrick

  • Writing an sql script to query a calculation view  and an attribute view inside a calculation view

    Hi,
    I was trying to query a calculation view with sql , and as one of the input parameters i was trying to give a query over an attribute view
    So my sql will look like this
    SELECT * FROM "MyApp.calculation_views::GET_CHECKLIST_FOR_ACCOUNT"('PLACEHOLDER' = ('$$ACCOUNT_ID$$', '1','$$CHECKLIST_ID$$',' SELECT CHECKLIST_ID FROM "MyApp"."CHECKLIST_PRODUCTS" WHERE PRODUCT_ID = 5'));
    So as an input to $$CHECKLIST_ID$$   i wanted to give an id selected from checklist products table where products id is passed as an input
    but this is not working, i am getting syntax error at the $$CHECKLIST_ID$$ there i can only pass values like  $$CHECKLIST_ID$$, '1'
    Please help me to figure out which  is the correct syntax  i tried putting the sql statement to get the checklist_id in '' but it too didnot work

    I'm not sure you'll be able to do a SELECT subquery directly in the placeholder definition, but you can create another calc view (scripted) as a wrapper to your original calc view and use a scalar variable to pass the parameter over.
    Try this as the base code for your second calc view:
    var_id VARCHAR(10);
    BEGIN
         SELECT CHECKLIST_ID INTO :var_id FROM "MyApp"."CHECKLIST_PRODUCTS" WHERE PRODUCT_ID = 5;
         var_out = SELECT * FROM "MyApp.calculation_views::GET_CHECKLIST_FOR_ACCOUNT"
              (PLACEHOLDER."$$ACOUNT_ID" => 1, PLACEHOLDER."$$CHECKLIST_ID$$" => :var_id);
    END
    You could even create input parameters in the second Calc View for the Account Id & Product Id (which are currently hard coded in your code below).
    Best,
    Henrique.
    PS: avoid using SELECT * for the var_out in the scripted calc view. It's better, from a code maintenance perspective, to explicitly define the columns you're outputting.

  • Attribute View no 'Add Key Attribute'

    Hi,
    I don't know if this is just a beginner problem, but I tried to run some of the training data and fail to compile an Attribute View simply cause the Key Attribute is missing. I click on a field and I get entries like Add To Output, but that's it.
    But to my understanding I would need this, or am I wrong?
    roland
    P.S.: Hana Studio 1.80.3

    Hi,
    You can mark a column as key attribute in two ways.
    1. Click on the column which you wanto mark it as key attribute after you add it to output, in properties of that column there is a key attribute property. Edit it as true.
    2. Add the columns to output, go to semantics node. Here in the list of columns select the column which you wanto mark as key attribute. Now either you can click on drop down of that rows first column and select Key Attribute or you can click on key attribute button in columns pane.
    Regards,
    Rashmi

  • How can I calculate column percentage in Essbase report writer?

    If you think about sample:basic, I have Q1 and Q2 on my columns and PkgType, Bottle and Can on my rows. i want to create a new column "%" and show the quarterly values as a percent of PkgType for the respective quarter. Essbase Analytical Services Technical Reference has this example but it doesn't work on my report, I don't if it's because I have attribute dimension on my rows:
    // This report performs column calculations based on values in a
    // report row.
    <PAGE (Scenario, Product, Market)
    Actual
    <COLUMN (Year)
    Qtr1 Qtr2
    { DECIMAL 2 3 4 }
    { NAMEWIDTH 22 WIDTH 7 3 4 }
    { ORDER 0 1 3 2 4 5 }
    <ROW (Accounts)
    { SAVEROW } Sales
    { CALCULATE COLUMN "%" = 1 % "Sales" 1 }
    { CALCULATE COLUMN "% " = 2 % "Sales" 2 }
    { CALCULATE COLUMN "Avg" = 1 + 2 / 2. }
    <DESCENDANTS Accounts
    Any help will be much appreciated!

    sorry that example was based on Demo:Basic and it does work but when apply that logic to what I try to do, it doesn't work.
    Please see the PkgType example I sent and I am trying to get this result in Sample:Basic.
         Sales     New York     Product     Actual
         Qtr1     %     Qtr2     %
    Pkg Type     7,705     100     9,085     100
    Bottle     5,707     74.07     6,727     74.04512933
    Can     1,998     25.93     2,358     25.95487067
    I tried this script but didn't work:
    <PAGE("Measures","Market","Product","Scenario")
    <COLUMN("Year")
    <ROW("Pkg Type")
    "Sales"
    "New York"
    "Product"
    "Actual"
    "Qtr1"
    "Qtr2"
    "Pkg Type"
    "Bottle"
    "Can"
    { CALCULATE COLUMN "%" = 1% "Pkg Type" 1 }
    { CALCULATE COLUMN "% " = 3 % "Pkg Type" 3 }
    !

  • Dynamically Hiding Column in a Table View in VC Model

    How to dynamacally hide the columns in a table view in a VC model. Through the expression in Control Property, Form element/field or table view as a whole can be made hidden, however, the individual column can not seem to be hidden.
    I am using VC server version 700.8.0.1.
    Any help would be much appreciated.
    Kind Regards
    Sanjoy

    In this scenario, if the source is SAP BI, you can use the webapi commands. If not, you would have to have 2 separate tables in different layers and you can show and hide those layers or UI elements...

  • Not able to view Data Preview of Attribute View,AV and CV

    HI,
    I have created tables and then created the required attribute view, analytic view and calculation view for parent child hierarchy.
    I'm facing two problems
    1. I'm not able to see the "Data Preview" of any of the views.
    2. When i'm trying to import data from HANA from MS-EXCEL 2010 with data connection wizard, then connection is established successfully but after that instead of showing cubs its giving the following error
    Regards,
    Ch3tan

    Hi Seshadri Sreenivas R,
    I executed following queries
    Statement 'SELECT * FROM "_SYS_BI"."BIMC_ALL_CUBES"' successfully executed in 158 ms 518 µs  (server processing time: not supported by server)
    Fetched 0 row(s) in 0 ms 0 µs
    Statement 'SELECT * FROM "_SYS_BI"."BIMC_CUBES"' successfully executed in 195 ms 12 µs  (server processing time: not supported by server)
    Fetched 0 row(s) in 0 ms 0 µs
    I got 0 rows .
    I redeployed and reactivated successfully, then clicking on data preview i'm getting the same error
    Waiting for your suggestion.
    Regards
    Ch3tan

Maybe you are looking for