Using a macro for a pivot table

Hi guys,
I have read the question above and the answers provided in this thread. However, I am still struggling to record a Macro template with a Pivot Table. I am using a Mac and Excel 2011. 
My steps involve the following:
1) I import a CSV file
2) I format the cells (time of day into 12:00 am format)
3) I create a simple pivot table (time of day and the total site visits)
4)I group the time of day and colour code the total site visits
Now, this is where I get confused. Usually, I delete all the information so my cells remain empty, but remain with working macros. With the pivot table, I have deleted the pivot table and left it in its original state but nothing has worked yet.
I have tried importing new data into my Macro template (with a pivot table) but I keep receiving the 1004 error, so I need to debug the code. Now I have no knowledge of VBA but I when I hit "debug", it says I need to delete/change some code (as
you have done in the thread above). However, i never deleted any sheets (as the user did above) so, I don't know where I am going wrong.
Any help would be most welcome. Below is the code that is appearing on my erroneous macro:
Sub Macro5()
' Macro5 Macro
    Range("A8").Select
    Selection.NumberFormat = "[$-F400]h:mm:ss AM/PM"
    Selection.AutoFill Destination:=Range("A8:A175")
    Range("A8:A175").Select
    Range("A7:B175").Select
    Sheets.Add
    ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
        "Test 1.csv!R7C1:R175C2", Version:=xlPivotTableVersion14).CreatePivotTable _
        TableDestination:="Sheet1!R3C1", TableName:="PivotTable4", DefaultVersion _
        :=xlPivotTableVersion14
    Sheets("Sheet1").Select
    Cells(3, 1).Select
    ActiveSheet.PivotTables("PivotTable4").AddDataField ActiveSheet.PivotTables( _
        "PivotTable4").PivotFields("Sessions"), "Sum of Sessions", xlSum
    Range("A5").Select
    Selection.Group Start:=True, End:=True, Periods:=Array(False, False, True, _
        False, False, False, False)
    Range("B5:B28").Select
    Selection.FormatConditions.AddColorScale ColorScaleType:=3
    Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
    Selection.FormatConditions(1).ColorScaleCriteria(1).Type = _
        xlConditionValueLowestValue
    With Selection.FormatConditions(1).ColorScaleCriteria(1).FormatColor
        .Color = 7039480
        .TintAndShade = 0
    End With
    Selection.FormatConditions(1).ColorScaleCriteria(2).Type = _
        xlConditionValuePercentile
    Selection.FormatConditions(1).ColorScaleCriteria(2).Value = 50
    With Selection.FormatConditions(1).ColorScaleCriteria(2).FormatColor
        .Color = 8711167
        .TintAndShade = 0
    End With
    Selection.FormatConditions(1).ColorScaleCriteria(3).Type = _
        xlConditionValueHighestValue
    With Selection.FormatConditions(1).ColorScaleCriteria(3).FormatColor
        .Color = 8109667
        .TintAndShade = 0
    End With
    Selection.FormatConditions(1).ScopeType = xlSelectionScope
    Range("H14").Select
    Sheets("Test 1.csv").Select
    Sheets("Test 1.csv").Move Before:=Sheets(1)
    ActiveWindow.SmallScroll Down:=-598
    Range("A6").Select
End Sub

Hi,
Base on my test in excel 2013, it works fine.
You said your excel version is excel 2011, there isn’t that version of office.
>> I keep receiving the 1004 error
Does it has detail error message?
>> it says I need to delete/change some code
Could you provide the screenshot here?
On the other hand, you may share a sample file on the OneDrive.
Regards
Starain
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.

Similar Messages

  • Change connection from SQL to SSAS for power pivot table

    Hi,
    I have created a power pivot table using MDX query from SSAS. I also created multiple pivot table and other complex reports using this power pivot table. Now I should use a different cube which has almost different columns than the old cube. It would be
    a hassle now to simply change the query and hence redoing the entire report due to column name changes. I was hoping to use the SQL OPENQUERY using linked server to get data from SSAS using MDX to SQL so that I can alias the column names to old. The problem
    now is I cannot change the connection for existing power pivot table to a different provide (sql) from SSAS. Is there anyway I can do this?
    Please let me know if there is any other way that would save me from re-doing the entire report.
    Thanks

    Unfortunately, you can't just repoint the connection currently - you will need to rebuild it. I've run into this myself not too long ago, and the team is aware of the requirement.
    John

  • Best PC specification for Large Pivot tables

    Hi there
    I currently have a 6 month old Dell Vostro 470 with Intel Core i7 quad processor 3.4ghz processor and 8gb SDram, 2tb hard drive and 1gb graphics card.  I run Office 2010, but 99% of my work is in Excel and specifically Pivot Tables.
    I run large Excel spread sheets typically size around 200-300mb built around a data sheet that may have up the 1m row limit and 200 columns.  A quick glance shows that I have 1000mb files (what is that 1gb?, 1m kb if I have that right) which seem to open
    quite quickly, less than a minute, but on all my large files I do have issues around crashes, being able to refresh the pivot. 
    Typically I may have 20 worksheets in a workbook  all relating to the same source data sheet, which may be in the same workbook or in a separate workbook on the same pc.
    I have two queries.  Where best to go for advice on the best PC spec for my type of work (if not here)?  and specific advice realting to a purchase.  I am contemplating a dell Optiflex and wondering if a 32gb SD RAM memory will give worthwhile
    extra performance against the 8gb that I have now and whether Dell has better processors that might suit me better.
    I do find that on current Vostro 470 system with my 8gb quad processor, an Excel spread sheet will stop working when it exceeds a little more than 1.5gb memory according to task manager (How does that relate to 8gb of SDRAM?). 
    Often I have a number of workbooks open to enable the pivots to refresh. Usually it just says insufficient resource.  I have found it useful to have the Pivot source data as a CSV file to reduce size, but I still find myself constantly having to adapt
    some spread sheets so that if the pivot source data file is only 500,000 rows then sometimes I have to limit the Pivot source to that number (rather then 1m) which is difficult if the size increases next time I need to refresh the pivots.
    So I have these issues around the ability to update (refresh) Pivot tables, the size of workbooks I can open and to a degree the speed that my pc will calculate, even though I often have to work with worksheets that do not recalculate automatically ie I turn off
    automatic updates, so that it works efficiently.
    2 KEY QUESTIONS:
    ·         Where best to go for advice on how to manage large data sheets/ pivot tables?
    ·         What spec of pc to go for optimum efficiency of my Excel/ pivot table needs?
    I SPENT JUST LESS THAN £1,000 with Dell on my last Dell Vostro 470 (including Office 2010). 
    ·         Should I go for a Dell Optiflex and pay extra £400 to get 32gb SDRAM and could I spend even more to improve my work efficiency?
    ·         How  fast are the fastest Processors and can I improve much on what I have with my Dell Vostro 470
    ·         Are there any other PC's out there I should be considering?
    ·         I sometimes get messages like insufficient resources to display correctly. 
    Do I need a better graphics card?
    Sorry this posting is so long.  If you have been, thanks for reading
    Not quite sure which forum to go for, so advice especially appreciated.
    Jesper

    My thanks for that.  I would be very pleased if there was a solution.
    I am in fact running 64bit Win7 Professional but my pre-installed Office 2010 is 32bit.  Does that sound strange?   I really don't know much about 32bit and 64 bit.
    Would I have to purchase an entirely new copy of 64bit to get the memory benefits of which you speak? I'm assuming that if so I would would have to buy Office 64bit, rather than just buy a copy of Excel 2010 or 2013 64 bit?
    Many thanks for you help.
    As a secondary question, it seems on investigation, that my processor is one of the best around.  Could you advise? 
    OS Name    Microsoft Windows 7 Professional
    Version    6.1.7601 Service Pack 1 Build 7601
    Other OS Description     Not Available
    OS Manufacturer    Microsoft Corporation
    System Name    DELL470
    System Manufacturer    Dell Inc.
    System Model    Vostro 470
    System Type    x64-based PC
    Processor    Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz, 3401 Mhz, 4 Core(s), 8 Logical Processor(s)
    BIOS Version/Date    Dell Inc. A06, 25/05/2012
    SMBIOS Version    2.7
    Windows Directory    C:\Windows
    System Directory    C:\Windows\system32
    Boot Device    \Device\HarddiskVolume2
    Locale    United Kingdom
    Hardware Abstraction Layer    Version = "6.1.7601.17514"
    User Name    Dell470\DellPG
    Time Zone    GMT Standard Time
    Installed Physical Memory (RAM)    8.00 GB
    Total Physical Memory    7.96 GB
    Available Physical Memory    5.09 GB
    Total Virtual Memory    15.9 GB
    Available Virtual Memory    12.7 GB
    Page File Space    7.96 GB
    Page File    C:\pagefile.sys
    Many thanks, Jesper

  • Can't we use Binary SEARCH  for TYPE SORTED TABLE?(Performance Improvement)

    Hi Expert!
                       I have declare a sorted type table with NON -UNIQUE, and want to use Binary search in read statement. But while  using bunary search in read statement I'm facing an error. The ERROR is
    "Table LI_MARC is a SORTED TABLE or INDEX TABLE. The BINARY SEARCH
    addition is only allowed for these tables if the key specified is an
    initial part of the table key."
    Please find detail
    TYES: tt_marc  TYPE SORTED TABLE OF marc   WITH NON-UNIQUE KEY matnr,werks.
    DATA: li_marc type tt_marc.
    READ TABLE li_marc INTO marc WITH KEY matnr = i_mbew-matnr     
                                                                          werks = i_mbew-bwkey BINARY SEARCH . 
    To my understanding , there is no need to mention Bianry Search  for sorted table TYPE. Please  let me know can  i use ?

    Hello,
    there is no need to mention Bianry Search for sorted table TYPE.
    Yes, this is because for SORTED TABLEs binary search algorithm is used by default for READ TABLE. Although you can use BINARY SEARCH addition but it's use is redundant.
    As for your case you've defined the KEY fields incorrectly There shouldn't be any "comma(s)" between the fields.
    TYPES: tt_marc TYPE SORTED TABLE OF marc WITH NON-UNIQUE KEY matnr werks.
    When you define it with commas
    TYPES: tt_marc TYPE SORTED TABLE OF marc WITH NON-UNIQUE KEY matnr, werks.
    the result is something like this:
    TYPES: tt_marc TYPE SORTED TABLE OF marc WITH NON-UNIQUE KEY matnr.
    TYPES: werks.
    Hence you were getting the syntax error!
    BR,
    Suhas
    PS: As for MARC you can use UNIQUE KEY addition because MATNR & WERKS are the key fields in the table.

  • Use of filter in my pivot table

    Hi!!
    I am using jdeveloper 11.1.1.5
    I had created a read only ViewAdfVO.
    Here s the querry
    select
    glal_plant "glgh_parent_group",
    gacl_acct_type||glal_plant  "glgh_group",
    DECODE(gacl_acct_type,'A','ASSETS','L','LIABILITIES','Q','EQUITY', 'R','REVENUE','E','EXPENSES') "description",
    NULL "acct_id",
    NULL "ACT",
    null "glal_plant" ,
    GACL_ACCT_TYPE,(gjh_jrnl_type||'-'||gjh_jrnl_no||'-'||gjh_jrnl_sfx) "jrnltypesfx",
    (GAPB_LVL1||'-'||GAPB_LVL2||'-'||GAPB_LVL3||'-'||GAPB_LVL4||'-'||GAPB_ACCT) as periodicacct,gapb_debit_amt,gapb_credit_amt,gapb_year,gapb_period,fy_year
    from gl_jrnl_hd,gl_acct_periodic_bal,gl_accts,gl_account_classes,gl_lvl_accounts,gl_jrnl_ln,fin_years
    where  gapb_bu = GLAC_BU and GLAC_BU = GACL_BU and GACL_BU=GLAL_BU and gapb_bu = 'RJL'
    and gjh_bu = gapb_bu and gjh_jrnl_no = gjl_jrnl_no and gjh_bu = gjl_bu and gjh_jrnl_type = gjl_jrnl_type and gjh_jrnl_sfx = gjl_jrnl_sfx
    and GJL_ACCT = glal_acct and gapb_acct = glal_acct and GLAL_CL_ID = GLAC_CL_ID and glal_acct = glac_acct and GACL_ID = GLAC_CL_ID
    and fy_year = gapb_yearIn this i need to use fy_year as a filter in my pivot table. But while i am using fy_year no data had been retrievied
    pls verify the link if i am not clear
    http://www.4shared.com/photo/yFJGryn0/E054.html

    Hi,
    does this help you?
    http://docs.oracle.com/cd/E24382_01/web.1112/e16181/dv_crosstab.htm#BGBHAGGI
    ~Abhijit

  • How can I do a Header Group Using Group columns for WD ALV tables

    Hi
    I want to group columns into a header group.
    Eg:
                       from Date
    Availability
                       to date
    Any ideas if it is possible with WD ALV tables?

    Hi,
    Try to use the if_salv_wd_field_settings for the column grouping of the Model object.
    Also check the class CL_SALV_WD_FIELD.
    Regards,
    Lekha.

  • Can I use Parallel execution for Global Temporary table within SP and How

    Dear Gurus,
    I have Global temporary table as below
    Create global temporary table Temp_Emp
    empno number,
    ename varchar2(20),
    deptno number
    ) on commit preserve rows;
    During processing I insert the data into this table and then fire query on Temp_Emp, get the data and pass it to front end.
    The SP as shown below
    Create or replace procedure get_emp_data
    empid in number,
    emp_detail out RefCsr -- Ref cursor
    as
    begin
    -- some code here
    open emp_detail for
    select *
    from Temp_Emp
    where empno = empid;
    end get_emp_data;
    Can use Parallel Query execution on Temp_Emp table and how ?
    i.e. do need to explicitly use parallel construct in query or is it default.
    Because I have many SQL like above (on global temporary tables) within Stored Procedures.
    Can anybody give me any suggestion.
    Thanking in Advance
    Sanjeev

    How come you are populating a temporary table and then opening a cursor on this temporary table for the front end to use?
    Couldn't you presumably just form a query out of the code you use to populate the temporary table? This is the recommended approach in Oracle.

  • How can I use create/createInsert for two different tables

    Hi All,
    I am showing different fields in the UI from different tables. I am able to fetch the data from all the tables and able to modify and save the data.
    Now, the problem when I want to create/insert some data into those columns(from different tables) I am facing issues.
    How can I proceed further??

    Hi Shay,
    Thank you very much for your quick response.
    Actually I am totally new in ADF world and I am trying to implement some applications in ADF.
    I created an UI based on some 3 tables(there is foreign key relation between them) and some other tables. I am able to modify and save my application if there is any data in all the tables.
    My Actual issues are
    1) I removed all the data from the tables. There is a submit(CreateInsert) button, what I expected is on click of the button I should see all the fields in editable mode. But I was able to see only few fields and also in readonly mode. So here my issue is how can i create and save these data.
    2) Consider on my landing page I have just CommandLink/CommandButton. After clicking that page I should get the above screen in create mode(I mean to say all fields in editable mode). How can achieve this?
    Thanks & Regards,
    Ravi.

  • How to use Inner Join for these 4 table's

    Hi Guys,
                  My Requirement is i have to get the data into the final Internal table whose structure is like this (BWKEY   type  MBEW-BWKEY,
            MATNR   type  MBEW-MATNR,
            MAKTX   type  MAKT-MAKTX,
            BWTTY   type  MBEW-BWTTY,
            BWTAR   type  MBEW-BWTAR,
            MEINS   type  MARA-MEINS,
            BKLAS   type  MBEW-BKLAS,
            VPRSV   type  MBEW-VPRSV,
            STPRS   type  MBEW-STPRS,
            PEINH   type  MBEW-PEINH,
            CRCY(3)    type  c,
            LBKUM   type  MBEW-LBKUM,
            SALK3   type  MBEW-SALK3,
            LAEPR   type  MBEW-LAEPR,
            J_3ADEFSI   type  MARC-J_3ADEFSI,
            J_4kDEFSC   type  MARC-J_4kDEFSC,
            SCLAS   type  MARA-/AFS/SCLAS,
            EKALR   type  MBEW-EKALR,
            HKMAT   type  MBEW-HKMAT,
            HRKFT   type  MBEW-HRKFT,
            KOSGR   type  MBEW-KOSGR,
            PRCTR   type  MARC-PRCTR,
            MMSTA   type  MARC-MMSTA,
            SOBSK   type  MARC-SOBSK,
            PPRDL   type  MBEW-PPRDL,
            LPLPR   type  MBEW-LPLPR,
            PPRDZ   type  MBEW-PPRDZ,
            ZPLPR   type  MBEW-ZPLPR)
                  from 4 table's MBEW , MARA MAKT and MARC.
         Can anybody provide the logci for this based on the below requirement
    "Go to table MBEW with material number, plant and valuation type; fetch the information laid out in output format. There are some fields which need to come from tables MARC, MARA and MAKT. The common criterion is material number across these tables.
    MBEW-MATNR = MARC-MATNR
    MBEW-MATNR = MARA-MATNR
    MBEW-MATNR = MAKT-MATNR
    Thanks,
    Gopi.

    Hello Gopi,
    I did not have system now and just written in notepad..
    types : begin of ty_mbew ,
    MATNR type MBEW-MATNR,
    BWTTY type MBEW-BWTTY,
    BWTAR type MBEW-BWTAR,
    MEINS type MARA-MEINS,
    BKLAS type MBEW-BKLAS,
    VPRSV type MBEW-VPRSV,
    STPRS type MBEW-STPRS,
    PEINH type MBEW-PEINH,
    CRCY(3) type c, " What is this field ,i did not include in join
    LBKUM type MBEW-LBKUM,
    SALK3 type MBEW-SALK3,
    LAEPR type MBEW-LAEPR,
    J_3ADEFSI type MARC-J_3ADEFSI,
    J_4kDEFSC type MARC-J_4kDEFSC,
    SCLAS type MARA-/AFS/SCLAS,
    EKALR type MBEW-EKALR,
    HKMAT type MBEW-HKMAT,
    HRKFT type MBEW-HRKFT,
    KOSGR type MBEW-KOSGR,
    PRCTR type MARC-PRCTR,
    MMSTA type MARC-MMSTA,
    SOBSK type MARC-SOBSK,
    PPRDL type MBEW-PPRDL,
    LPLPR type MBEW-LPLPR,
    PPRDZ type MBEW-PPRDZ,
    ZPLPR type MBEW-ZPLPR,
    end of ty_mbew.
    types : begin of ty_makt ,
    matnr type makt-maktx,
    MAKTX type MAKT-MAKTX,
    end of ty_makt.
    types : begin of ty_final ,
    MATNR type MBEW-MATNR,
    MAKTX type MAKT-MAKTX,
    BWTTY type MBEW-BWTTY,
    BWTAR type MBEW-BWTAR,
    MEINS type MARA-MEINS,
    BKLAS type MBEW-BKLAS,
    VPRSV type MBEW-VPRSV,
    STPRS type MBEW-STPRS,
    PEINH type MBEW-PEINH,
    CRCY(3) type c,
    LBKUM type MBEW-LBKUM,
    SALK3 type MBEW-SALK3,
    LAEPR type MBEW-LAEPR,
    J_3ADEFSI type MARC-J_3ADEFSI,
    J_4kDEFSC type MARC-J_4kDEFSC,
    SCLAS type MARA-/AFS/SCLAS,
    EKALR type MBEW-EKALR,
    HKMAT type MBEW-HKMAT,
    HRKFT type MBEW-HRKFT,
    KOSGR type MBEW-KOSGR,
    PRCTR type MARC-PRCTR,
    MMSTA type MARC-MMSTA,
    SOBSK type MARC-SOBSK,
    PPRDL type MBEW-PPRDL,
    LPLPR type MBEW-LPLPR,
    PPRDZ type MBEW-PPRDZ,
    ZPLPR type MBEW-ZPLPR,
    end of ty_final.
    Internal tables
    data :i_mbew type standard table of ty_mbew,
    i_makt type standard table of ty_makt,
    i_final type standard table of ty_final.
    Work Areas
    data : wa_mbew like line of i_mbew,
    wa_makt like line of i_makt,
    wa_final like line of i_final.
    start-of-selection.
    get the data from MBEW,MARA,MARC Table
    select aMATNR aBWTTY
           aBWTAR bMEINS
           aBKLAS aVPRSV
           aSTPRS aPEINH
    *CRCY(3) type c,
    aLBKUM aSALK3 a~LAEPR
    c~J_3ADEFSI type MARC-J_3ADEFSI,
    c~J_4kDEFSC type MARC-J_4kDEFSC,
    b~SCLAS type MARA-/AFS/SCLAS,
    aEKALR aHKMAT
    aHRKFT aKOSGR
    cPRCTR cMMSTA
    cSOBSK aPPRDL
    aLPLPR aPPRDZ
    a~ZPLPR into corresponding fields of table i_mbew
            from mbew as a inner join mara as b on bmatnr = amatnr
            inner join marc as c on cmatnr = amatnr.
    if sy-subrc eq 0.
    select matnr maktx from makt into table i_makt
                 for all entries in i_mbew
                 where matnr = i_mbew-matnr
                 and   spras = sy-langu.
    endif.
    loop at i_mbew into wa_mbew.
    read the data from MAKT Table
    read table i_makt into wa_makt with key matnr = wa_mbew-matnr.
    if sy-subrc eq 0.
    move-corresponding wa_mbew to wa_final.
    move wa_makt-maktx to wa_final-maktx.
    append wa_final to i_final.
    endif.
    endloop.
    Thanks
    Seshu

  • Can I use several adapters for polling multi tables

    Hi,
    I need to have 100 db polls.
    Can I use one bpel to recive data, is there any way to reduce the nunber of bpels ?
    Regards

    Maybe if you use a view that does a union on all tables. But I would not recommend this as you may get a massive performance hit. Use the DB Poll functionality to poll off the view.
    In your test case I would imagine that each table gets different information therefore each data set should be managed separately therfore you will have to 100 BPEL processes anyway.
    cheers
    James

  • App-V Reporting: SQL query for Excel Pivot Table to display App Usage (H/M/S)

    I recently posted this in the Gallery.  If anyone has any modifications or enhancements please feel free to contribute!  One thing that I'd like to be able to add to it is the ability to only display information for applications/packages that are
    still published, so if anyone can figure out a crafty way to do it...  Thanks!
    http://gallery.technet.microsoft.com/App-V-Reporting-SQL-query-6695d3c3

    I recently posted this in the Gallery.  If anyone has any modifications or enhancements please feel free to contribute!  One thing that I'd like to be able to add to it is the ability to only display information for applications/packages that are
    still published, so if anyone can figure out a crafty way to do it...  Thanks!
    http://gallery.technet.microsoft.com/App-V-Reporting-SQL-query-6695d3c3

  • Showing Zero values in OLAP Pivot Table for Excel 2007

    Hello,
    I needed a help to a problem. Is it possible to show the values with No sales in an Olap Pivot Table ??
    I have a sales Cube, and brwsing it via excel i wanted to filter on a Product Category and see how many products in this category had made no Sales. By default the Pivot table doesn't shows the empty values, so if i check the Showm empty rows option for
    Pivot Tables, i see the whole of the products populated with and without sales, and i can't filter further. Is there a way i can only get those which have no sales.
    Vinish Viswanathan

    Happy Holidays,
    I can slice on product categories in Excel 2013 with these settings for the Pivot Table:
    Activate "Show items with no data for rows and columns"
    Apply a value filter that says that the measure should filter on values = 0
    Have the product natural hierarchy on rows with levels product category->subcategory->product.
    Expand the levels below product category
    Use the product category attribute and not the hierarchy as the filter.
    I do not have Excel 2007 installed anymore.
    HTH
    Thomas Ivarsson

  • Guage and Pivot table uses in OBIEE

    Hello Folks,
    please help to understand what is PIVOT TABLE and GAUGE in OBIEE answers
    in what cases or scenario will this things be used.
    and what is CASE in OBIEE, where is it used and what is its use .
    thanks in advance
    KMR

    The pivot table view is an interactive view that allows you to rotate the rows, columns, and section headings to obtain different perspectives of the data. Pivot tables are navigable and drillable, and are especially useful for trend reports.
    Gauges are useful for showing performance against goals. Supported gauge types include dial, bar, and bulb-style gauges.
    CASE statement is used for conditions, usage is case when x=y dothis end.. Its like IF statement in programming.
    - Madan

  • Using Slicer to change row dimension in pivot table

    I have a requirement to display a measure amount by Quarter,Month or Week of Year.  The user needs to select one of three slicer buttons, Quarter, Month or Week.  I have tried creating a calculated column in my tables, e.g PeriodToDisplay using
    "If" or "Switch".  
    PeriodToDisplay:=Switch (Dates[PeriodSelected],"Quarterly",FactTableName[Qtr],"Monthly",FactTableName[Month],"Weekly",FactTableName[weeknum])
    Where Dates[PeriodSelected] is just a 3 row table with , Quarterly,Monthly,Weekly rows.  I display those as a slicer in the powerpivot view.
    The FactTableNames are where the aggregation sql have been done.  The row labels now are:
    Qtr
    Month
    Week
    And the granularity i know can be collapsed by the user but they do not want to see a Qtr displayed when they only want to see the month.
     I receive an error message the Quarter is not in the proper context or is a circular reference.

    The behavior you want can be achieved with a hierarchy built in the Power Pivot model, and then using Excel's drill down functionality on the pivot table.
    Alternately, you could define an MDX named set for the pivot table to define the rowfilters.

  • Using An Array Formula within a Pivot Table

    Hello Everyone!
    I've discovered a problem with using the Pivot Table. I wish to add this array formula for Counting Distinct names into a Pivot Table, but within Power Query for Excel 2013, it won't allow me to add an array formula. I need to use slicers for filtering city
    names which I'm not able to with this new restriction. 
    For example, suppose I wish to get (using a slicer) a distinct count of city names in a particular year using the year slicer. I cannot do this as I am not allowed to use array formulas within the Pivot Table which contains names of cities according to years.
    If I use the array formula for counting distinct city names outside the Pivot Table, then I won't be able to use the year slicer in order to get a distinct count of names of cities.
    Is there a way around this problem and how may I be able to resolve it ??
    Appreciate your help. Thanks.
    The problem with being punctual is, there's nobody there to appreciate it !!!

    Hello Everyone!
    I've discovered a problem with using a Pivot Table. I wish to add an array formula for Counting Distinct names into a Pivot Table, but within Power Query for Excel 2013, it won't allow me to add an array formula. I need to use slicers for filtering city names
    which I'm not able to with this new restriction. 
    For example, suppose I wish to get (using a slicer) a distinct count of city names in a particular year using the year slicer. I cannot do this as I am not allowed to use array formulas within the Pivot Table which contains names of cities according to years.
    If I use the array formula for counting distinct city names outside the Pivot Table, then I won't be able to use the year slicer in order to get a distinct count of names of cities.
    Is there a way around this problem and how may I be able to resolve it ??
    Appreciate your help. Thanks.
    The problem with being punctual is, there's nobody there to appreciate it !!!

Maybe you are looking for