Dynamic Measure - Selecting which fields to include in a calculation

Hello all,
and thank you so much for spending your time reading this. I'm working on PowerPivot in Excel 2010. But if you know there's a solution in 2013, please let me know and I'll try to justify an upgrading. I have a table for my data source where the rows
are products and I have a list of columns with years. Each cell is the number of items sold:
I'm setting up a spreadsheet in Excel 2010 and also a page in PowerView to compare how they look. I have some slicers that work on which items to be included in the calculations, ie. average sales. Is there a way to create a slicer / filter fo
the user to select which years to include in the calculation of the average! For example: With slicers to select item 1 and item 2, but only years 2012 and 2013 to be included in the calculation of an average of sales? I can easily create
a slicer on items and a measure to calculate that average. However, I can't put the years in the equation.
Is there a way? Thank you

You could accomplish this with the technique of using disconnected tables/slicers in PowerPivot.  There are quite a few blog posts out there about different applications of disconnected tables/slicers.  Basically, it allows for using slicers as
a means of entering parameters into your measures.  Although extremely useful in many situations, it may be a little advanced and confusing for a new Power Pivot user. 
An easier option may be to reshape (unpivot) your data.  Instead of a short, wide table, it could be transformed into a long skinny table.  In other words, instead of having a different column for each year, you would only have a single column
called Year and another column called Values.  The Items column would simply contain duplicate entries for each item depending on the number of years.  No matter how many years are added in the future, you data table would still only have 3 columns
(Items, Year, and Value). In this scenario, measures are usually easier to write and the year column could also be used as a slicer.  The bonus is that PowerPivot is designed to perform much faster on long, skinny tables with fewer columns.
If your source data is from a database such as SQL Server, then your DBA can most likely create an unpivoted view for you pretty easily.  If that isn't an option or your data is from another source, you should download Power Query.  This is free
Excel Add-in from Microsoft, in the same family as Power Pivot, that is designed to reshape data from many different sources with no coding necessary in most cases.  Power Query has an Unpivot command built in and the results can be imported directly
to Power Pivot.

Similar Messages

  • Selection-screen (field from .Include structure)

    Hi all,
    I have a selection screen with several select-options. One of the select-option is
    select-options: s_vornr for afvc-vornr.
    Where 'vornr' is a .Include structure field in the table 'afvc'. Now my question is, in selection screen when I click on the box for this particular select-option I dont see the circle(from where we can select the existing input values) at the end of the box.
    Why is it so and how can get that circle option at the end of the box by sticking to the same table and field(afvc-vornr).
    Waiting for your help.
    Thanks

    hi,
    the field do not have nay value range with it.
    you can put the F4 help by using
    At Selection-Screen on Value-request <select-option>. event.
    e.g.
    DATA :  rt_values TYPE STANDARD TABLE OF type_values,
              rs_values TYPE type_values,
              rt_fields TYPE STANDARD TABLE OF type_fields,
              rs_fields TYPE type_fields.
      CLEAR    : rs_values,rs_fields.
      REFRESH  : rt_values,rt_fields.
    Creation of selection list
      rs_fields-tabname     = 'AFVC'.
      rs_fields-fieldname   = 'VORNR
      rs_fields-selectflag  = ' '.      
      APPEND rs_fields TO rt_fields.
       SELECT vornr form AFVC
                     INTO  TABLE t_vornr.
      SORT t_vornr.
      DELETE ADJACENT DUPLICATES FROM t_vornr.
      LOOP AT t_vornr INTO s_vornr.
        rs_values =  s_vornr-vornr.
        APPEND rs_values TO rt_values.
        CLEAR rs_values.
        ENDLOOP.
    FUNCTION 'HELP_VALUES_GET_WITH_TABLE'                   EXPORTING
          fieldname    = 'AFVC'
          tabname      = 'VORNR
          titel        = 'Counting
        IMPORTING
          select_value = <select-opion>
        TABLES
          fields       = rt_fields
          valuetab     = rt_values.
    amit
    Message was edited by: Amit Khare

  • Select which fields to copy of fields during creation of new version

    Hi Gurus-
    Is it possible to set config in a manner that will copy the authorization group value when creating a new version? 
    Thanks!
    -J
    Edited by: Jennifer Kramer on Mar 14, 2011 6:18 PM

    Hi,
    U have more samples for the scenario u can surf into our OTN Forum even for that
    http://forums.oracle.com/forums/search.jspa?threadID=&q=copy+row&objID=f83&dateRange=all&userID=&numResults=30&rankBy=10001
    Have a valueChange Listener for the Boolean chack box else if it binded in a ViewObject without Entity do the same in ViewRowImpl setter of the Check box Attrinute
    If has entity do it in EntityImpl setter of the check Box Attribute...
    Regards,
    Suganth.G

  • Urgent......  how to select few fields, from database table, (dynamic ita.)

    Dear all experts,
    I am able to populate all fields data from database table, using dynamic table creation.
    eg,
    SELECT *    FROM (w_tabname)    INTO    TABLE <t_itab>.
    where w_tabname is the table name given by the user, and t_itab is field symbol.
    but some requirement is like that i need to pick up only few fields, <b>which user will give at the runtime.</b>
    <b>I can</b> take those fields from file into any internal table,
    but the problem is that instead of <b>select *</b>, i need to put selected the fields given by user.
    i have tried with field symbol, it is not working (as per my knowledge.)
    do i need to create any structures dynamically ?
    Can anybody please help in this regards ?
    Your help will be surely rewarded with points.
    Waiting for reply..
    Regards
    Vinay

    Hi Vinay ,
    Adding to the below code , you can use some more fields in the select stmt as below:-
    REPORT ychatest.
    PARAMETERS : p_field1 LIKE dd03l-fieldname,
                             P_field2 LIKE dd03l-fieldname,
                             p_table LIKE dd03l-tabname.
    FIELD-SYMBOLS : <fs> TYPE STANDARD TABLE.
    SELECT (p_field1) (p_field2) ( FROM (p_table) INTO TABLE <fs>.
    Now p_field1 & p_field2  belong to the same table since you have give the user to enter only one table name.
    This should work fine.
    please try & let me know .
    Thanks & Regards,
    Daniel

  • How to create a dynamic RTF report which creates dynamic columns based on dynamic column selection from a table?

    Hi All,
    Suppose I have table, whose structure changes frequently on daily basis.
    For eg. desc my_table gives you following column name on Day 1
    SQL > desc my_table;
    Output
    Name
    Age
    Phone
    On Day 2, two more columns are added, viz, Address and Salary.
    SQL > desc my_table;
    Output
    Name
    Age
    Phone
    Address
    Salary
    Now I want to create an Dynnamic RTF report which would fetch data from ALL columns from my_table on daily basis. For that I have defined a concurrent program with XML as output type and have attached a data template/data definition to it which takes in XML as input and gives final output of conc program in EXCEL layout. I am able to do this for constant number of columns, but dont know how to do it when the number of columns to be displayed changes dynamically.
    For Day 1 my XML file should be like this.
    <?xml version="1.0" encoding="UTF-8"?>
    <dataTemplate name="XYZ" description="iExpenses Report" Version="1.0">
    <dataQuery>
    <sqlStatement name="Q2">
    <![CDATA[
    SELECT Name
    ,Age
    ,Phone
    FROM my_table
    ]]>
    </sqlStatement>
    </dataQuery>
    <dataStructure>
    <group name="G_my_table" source="Q2">
      <element name="Name" value="Name" />
      <element name="Age" value="Age" />
      <element name="Phone" value="Phone" />
    </group>
    </dataStructure>
    </dataTemplate>
    And my Day 1, EXCEL output from RTF template should be like this.
    Name     Age     Phone
    Swapnill     23     12345
    For Day 2 my XML file should be like this. With 2 new columns selected in SELECT clause.
    <?xml version="1.0" encoding="UTF-8"?>
    <dataTemplate name="XYZ" description="iExpenses Report" Version="1.0">
    <dataQuery>
    <sqlStatement name="Q2">
    <![CDATA[
    SELECT Name
    ,Age
    ,Phone
    ,Address
    ,Salary
    FROM my_table
    ]]>
    </sqlStatement>
    </dataQuery>
    <dataStructure>
    <group name="G_my_table" source="Q2">
      <element name="Name" value="Name" />
      <element name="Age" value="Age" />
      <element name="Phone" value="Phone" />
      <element name="Address" value="Address" />
      <element name="Salary" value="Salary" />
    </group>
    </dataStructure>
    </dataTemplate>
    And my Day 2, EXCEL output from RTF template should be like this.
    Name     Age     Phone     Address     Salary
    Swapnill     23     12345         Madrid     100000
    Now, I dont know below things.
    Make the XML dynamic as in on Day 1 there must be 3 columns in the SELECT statement and on Day 2, 5 columns. I want to create one dynamic XML which should not be required to be changed if new columns are added in my_table. I dont know how to create this query and also create their corresponding elements below.
    Make the RTF template dyanamic as in Day1 there must 3 columns in EXCEL output and on Day 2, 5 columns. I want to create a Dynamic RTF template which would show all the columns selected in Dynamic XML.I dont know how the RTF will create new XML tags and how it will know where to place it in the report. Means, I can create RTF template on Day 1, by loading XML data for 3 columns and placing 3 XML tags in template. But how will it create and place tags for new columns on Day 2?
    Hope, you got my requirement, its a challenging one. Please let me know how I can implement the required solution using RTF dynamically without any manual intervention.
    Regards,
    Swapnil K.
    Message was edited by: SwapnilK

    Hi All,
    I am able to fulfil above requirement. Now I am stuck at below point. Need your help!
    Is there any way to UPDATE the XML file attached to a Data Definition (XML Publisher > Data Definition) using a standard package or procedure call or may be an API from backend? I am creating an XML dynamically and I want to attach it to its Data Definition programmatically using SQL.
    Please let me know if there is any oracle functionality to do this.
    If not, please let me know the standard directories on application/database server where the XML files attached to Data Definitions are stored.
    For eg, /$APPL_TOP/ar/1.0/sql or something.
    Regards,
    Swapnil K.

  • Dynamic enabling of input fields via radio btn in report selection screen?

    Hi there!
    I was wondering whether one can dynamically enable/disable input fields on a selection screen of a report-program.
    Or is this only possible for selection screens in dynpro-programs?
    If possible for reports - could you give an example?
    Thanx a lot.
    Andreas

    Hi,
    yes..You can dynamically disable and enable inputs fields in the selection screen..
    Check this ex..If you press the first radio button..The second input will be disabled...And vice versa..
    PARAMETERS: p_r1 RADIOBUTTON GROUP g1 USER-COMMAND usr DEFAULT 'X',
    p_r2 RADIOBUTTON GROUP g1.
    PARAMETERS: p_input1 TYPE matnr MODIF ID m1,
    p_input2 TYPE matnr MODIF ID m2.
    AT SELECTION-SCREEN OUTPUT.
    LOOP AT SCREEN.
    IF p_r1 = 'X'.
    IF screen-group1 = 'M2'.
    screen-input = '0'.
    ENDIF.
    ELSE.
    IF screen-group1 = 'M1'.
    screen-input = '0'.
    ENDIF.
    ENDIF.
    MODIFY SCREEN.
    ENDLOOP.
    Thanks,
    Naren

  • Selection screen fields in which values have been entered

    Hi All,
    Is there any standard function module which enables us to determine which fields on the selection screen have values entered for them. In other words, I wish to determine which selection screen fields are no longer initial.
    Thanks and Regards,
    Vidya.

    Hi,
    Why cant you simply use in this way?
    if sel_screen_field1[] is not initial.  "for selet-options
    endif.
    if sel_screen_field1 is not initial.  "for parameters
    endif.
    is it not suitable for your case?
    //Kothand

  • Dynamic selection of field

    Hi All,
    I have to select a field dynamically from a selection screen and have to read that data for that field from database. I know the table and its EKPO..It can be any field from the table..How can i get a request help for the field on selection screen from table ekpo. There should be a parameter in the selection screen and when I press f4 it should show me all the fields from EKPO such that I can select a field and enter a value there by selecting the data. Could somebody please help.
    ekpo-?????.
    Thanks,
    Kiran

    Hi Kiran,
    use FM 'F4IF_INT_TABLE_VALUE_REQUEST'. It is quite well documented. You can select the fields with text from DD03M.
    Use at value-request for ...
    Regards,
    Clemens

  • Dynamic Selection of fields and those 0uputs using ABAP Programming

      Dear All
    I have a requirement I searched but couldn't able to find the closest one,
    kindly help me in this...
    I have 100 fields in one text file which is placed in AL11 server....
    Requirement is
    User should be able to run a report , by selecting any of the listed field and see any difference between the data in 2 text fields of diff dates...
    Ex: in 100 fields Employee Group and Dept no..2 fields he selects in selection-screen output and selects 2 text files from AL11 Server...
    if he executes report should produce only those employees who has difference in Employee Subgroup and dept no changes...
    writing the logic is not a big deal...
    but 2 challenges
    1) Empno , empname are fixed but remaining field columns should be what ever user selects. on the selection-screen
    2) How to populate fields on selection-screen??
    Regards
    Sas

    Hi Srinivas,
    Drop down is to select one field at a time,
    I need to select as many as user want to see the difference.......
    Regards
    Satish.v

  • Dynamic List Selection as a Parameter in another Recordset

    Please help.
    I have an ASP VBScript webpage. The first field on this page
    is a dynamic menu / list which lists footballers from a recordset.
    Whichever player is selected I then want to populate additional
    fields on the page (e.g. team he plays for) based on the selection.
    I was trying to extract the field value to a variable MM_Var6
    = Cstr(Request.Form(("PlayerName2")) and then use MM_Var6 in the
    WHERE statement of an additional recordset e.g. WHERE
    Teams.Playername = MM_Var6
    but can't help feeling there has to be an easier way of
    getting the data from the table rather than using an additional
    recordset. The above way doesn't seem to extract the value
    correctly from the list field.
    Am I just using the wrong syntax? or is there a better way of
    doing this?
    Can someone please point me in the right direction? Thanks,
    Chris.

    Try below:
    http://blogs.msdn.com/b/jackiebo/archive/2007/02/27/displaying-a-list-on-another-site-in-the-same-site-collection.aspx
    http://sharepointgeorge.com/2009/display-sharepoint-list-site-data-view-web-part/
    http://sharepoint.stackexchange.com/questions/37140/display-list-or-library-on-another-site-as-webpart
    http://stackoverflow.com/questions/938580/showing-the-list-view-web-part-for-a-list-in-another-site

  • Php/MySQL Repeated region which doen't include the last item?

    Hi,
    I hope somebody can help me with this. I use php/MySQL.
    I need t create a repeated region which doen't include the last item (post) added to the table.
    Does somebody know how to establish this?

    In SQL, there is no native concept of the last item inserted. It's up to you to control that. What is your definition of the last item? Is it the row with the greatest datetime stamp? An autoincrement id field? Something else?
    Using an autoincrement id field as an example, the last row inserted will have the largest value, so
    Select * from MyTable where MyID != (select max MyID from MyTable)

  • Adding Selection Options Fields in Report(Using Query)

    Hi,
    how can we add Selection Fields Options in Query Reports Which we create using SQ01. I need a default option by which we can add all the selection option given by user.
    Anybody can help me..?
    Regards
    lijo Joseph

    Do you have anything defined in the 'Calcs' section?
    If so, any fields returned by the query that are not included in the calculation will be automatically added to the Group fields (using the same logic as required with calculations/group by in any SQL query). The fields won't be able to be removed from the Group list unless the Calc is also removed.

  • Dynamic date selections in a variant

    Hi All,
    I need to dynamically change the date field of a report which runs every month end. Our working calendar is designed such that the last working day is the last Friday of the current period and hence the first working day is the last Saturday of the previous period. Now we have Fiscal Calendar variant which takes care of the last Friday part. I also know we have to select 'D' in the variant screen but my problem is in assigning the Last Saturday of the previous period in the date range field. Any hints or suggestions on this would be highly appreciated and of course rewarded generously.
    Thanks & Regards,
    Rajesh

    Hi Rajesh,
    After seecting Selection Variable "D" you have to carry out following things to cater your requirements;
    (a) Goto Name of Variable (input only using F4)
    (b) Select your variable depending upon your business requirement.
    Current Date
    From month start to today
    Current date +/- ??? days
    current date +/- ??? work days
    First day of current month
    <b>nth working day of current month</b>
    First day of next month
    First day of previous month
    Last day of previous month
    Last Day of the Current Month
    First quarter ????
    Second quarter ????
    Third quarter ????
    Fourth quarter ????
    Current date - xxx,current date + yyy
    Date - xxx, Date + yyy (work days)
    Previous month
    Current period
    (Beginning of mth-xx months, end of mth+yy months)
    I think nth working day of current month is suitable for your requirement.
    Bye,
    Muralidhara

  • Create Dynamic Structure based on Field-Symbol

    Hi Experts!!
    I need to create a structure with dynamic structure included within.
    I have a parameter on sel. screen in which we provide table name.
    PARAMETERS: p_table TYPE tabname.
    FIELD-SYMBOLS: <gt_data> TYPE ANY TABLE.
    CREATE DATA gr_data TYPE TABLE OF (p_table).
    ASSIGN gr_data-* TO <gt_data>.
    Now I need a structure like below:
    TYPES: BEGIN OF type_test,
    struct TYPE <gt_data>, " dynamic structure based on table name entered on sel. screen
    fld1 TYPE c,
    fld2 TYPE n,
    END OF type_test.
    Can somebody suggest how to achieve this?
    Your help is highly appreciated. Thanks a lot

    You can view this thread where our friend Marcin rocks .. Dynamically create a type
    FIELD-SYMBOLS: <gt_data> TYPE ANY TABLE.
    FIELD-SYMBOLS: <gs_wa> TYPE ANY.
    data:wf_ref type ref to data.
    DATA:i_comp TYPE cl_abap_structdescr=>component_table,
         i_tot_comp TYPE cl_abap_structdescr=>component_table.
    CREATE DATA gr_data TYPE TABLE OF (p_table).
    ASSIGN gr_data-* TO <gt_data>.
    create data wf_ref like line of <gt_data>.
    assign wf_ref->* to <gs_wa>.
    *--Getting Compoents from existing type
      lf_struct ?= cl_abap_typedescr=>describe_by_name( '<GS_WA>' ).
      i_comp = lf_struct->get_components( ).
      APPEND LINES OF i_comp TO i_tot_comp.
    The idea is Get all the field details available it to i_tot_comp, then append individual fields manually to
    i_tot_comp as explained in the link and create a dynamic structure and table.

  • BMBC Dynamic Date selection Variant

    Hello Team,
    I want to create variant in BMBC -Batch Information Cockpit with Dynamic Date Selection. But it do not find the screen the to set-up variant attributes
    This is the field where I want to have dynamic date selection, 1st Day of the month to Last day of the month.
    Field name and program
    I am using SE80
    As you can see screen number 0100 is not showing up. and I have gone though all available screen but i could not find the field.
    Please advise if dynamic date selection for this field is possible at all or there is other way.
    Thanks

    I don't think that it is possible to have dynamic date selection here. The whole selection screen is just dynamic, it has only place holders and you define in customizing which field is on the selection screen.
    You actually save a selection variant via this extra big button for selection variants, which is quite different to the disc icon where you usually save your selection variants and where  you have the option to define dynamic date fields.

Maybe you are looking for

  • What is difference between report programming and dialog programming?

    hi, what is difference between report programming and dialog programming? plz provide some example code bye

  • Passing EDI filename for 850 from B2B Gateway to BPEL

    Hi, Is there any way to pass the EDI filename for 850 from B2B Gateway to BPEL via AQ? we want to store the inbound filename in the database along with the PO. we are using 10g. Thanks, Naveen

  • Signal Level Varies

    I don't know if this is related or not but ever since we had several brief power outages the signal level from my Airport Extreme Base Station throughout the house is very low. The base has an antenna connected and is in the room with my main G5 comp

  • 7 hours now back to 1.1.4

    Unbelievable. After 7 hours of clicking, I finally connected with iTunes but when it was finished - I am back to 1.1.4. Plus when I click on "check for updates" it tells me that 1.1.4 IS the current version and I should check back on 7/18. Unbelieval

  • Adding another search module

    Hello, I would like to use http://www.helpuu.com/ search engine directly from Firefox (as a search module - search box in upper right corner of the browser). Is it possible? Thanks.