Pivot table (Year, Day, Hour)

Hi there,
I was wondering how do i simulate the pivot table concept if the variables are Days in the year or Hours in the year.
My table have columns
create table mytable(
keycol_onenumber(2),
keycol_two number(2),
keycol_three number(2),
keycol_four number(2),
keycol_five number(2),
year number(4),
day number
hour number(12,5),
values number(10,5));
Now for change in each keycolumn, and then for the day in the year or hour in the year i have to print values in the next line.
I looked at some of "asktom" articles which talks about using decode , but i don't think i can do that.
Can anyone suggest me ideas as to how to proceed.
THanks a bunch and have a great day.

I admit 7th column is null XOR 8th column is null
if you need 8700 columns, you can use 8700 decode.
SQL> with tbl as
  2    (select 11111 c1, 11 c2, 222 c3, 4444 c4, 1 c5, 2006 c6, 200     c7,null c8, 1.2 c9 from dual union all
  3     select 00001 c1, 10 c2, 555 c3, 7777 c4, 2 c5, 2006 c6, 121  c7,null c8, 2.3 c9 from dual union all
  4     select 12121 c1, 9  c2, 111 c3, 1111 c4, 1 c5, 2006 c6, null c7,2333 c8, 1.1 c9 from dual union all
  5     select 11111 c1, 11 c2, 222 c3, 4444 c4, 1 c5, 2006 c6, 100  c7,null c8, 1.2 c9 from dual )
  6  select
  7      c1,c2,c3,c4,c5,c6,
  8      decode(
  9          case when c7 is null and c8 is not null then 1 when c7 is not null and c8 is null then 2 else 3 end,
10          1, 'HOURS',
11          2, 'DAYS',
12          'N/A') type,
13  max(decode( case when c7 is null and c8 is not null then 1 when c7 is not null and c8 is null then 2 else 3 end, 1, decode(c8,0,c9), 2, decode(c7,0,c9))) m0,
14  max(decode( case when c7 is null and c8 is not null then 1 when c7 is not null and c8 is null then 2 else 3 end, 1, decode(c8,100,c9), 2, decode(c7,100,c9))) m100,
15  max(decode( case when c7 is null and c8 is not null then 1 when c7 is not null and c8 is null then 2 else 3 end, 1, decode(c8,121,c9), 2, decode(c7,121,c9))) m121,
16  max(decode( case when c7 is null and c8 is not null then 1 when c7 is not null and c8 is null then 2 else 3 end, 1, decode(c8,200,c9), 2, decode(c7,200,c9))) m200,
17  max(decode( case when c7 is null and c8 is not null then 1 when c7 is not null and c8 is null then 2 else 3 end, 1, decode(c8,2333,c9), 2, decode(c7,2333,c9))) m2333,
18  max(decode( case when c7 is null and c8 is not null then 1 when c7 is not null and c8 is null then 2 else 3 end, 1, decode(c8,8783,c9), 2, decode(c7,8783,c9))) m8783
19  from tbl
20  group by c1,c2,c3,c4,c5,c6,
21          case when c7 is null and c8 is not null then 1 when c7 is not null and c8 is null then 2 else 3 end
22  /
        C1         C2         C3         C4         C5         C6 TYPE          M0       M100       M121       M200      M2333      M8783
     11111         11        222       4444          1       2006 DAYS                    1.2                   1.2
         1         10        555       7777          2       2006 DAYS                               2.3
     12121          9        111       1111          1       2006 HOURS                                                    1.1but it is going to be very slow.
you could also use a plsql function which returns a clob, or you could use xquery (XML) if you have a recent version of Oracle

Similar Messages

  • How to place the page items horizontal in pivot table in OBIEE

    Hi experts
    In pivot table i have two pages items. And i want to place them horizaontaly. So how can i achieve this.
    for Ex: I have placed my two columns in page section of pivot table: Year,city.
    then i need as ;
    Year City
    where year is one dropdown list and city is another drop down list.
    Thanks in advance
    Regards
    Sunil

    Hi,
    We can seperate the page items using 'Start New Page Drop Down', but the item will be displayed in the next line.
    I think you would like to show them side by side i.e, horizontally..
    If it is, i think it is not possible as of OBIEE 10.1.3.3.. not sure about 10.1.3.4..
    Please let me know if my assumption is wrong.. I will be very happy if anyone corrects me..:)
    -Vency

  • Monthly and Yearly info on the same Pivot Table

    Hi everyone,
    I have a couple of questions.
    1) I want to show the same results by month and by year on the same pivot table. Is there any way this can be done?
    2) I would also like to show data on graphs by month. To do this i have added my date field to the table (hidden) and used the function MONTHNAME(expr). This works fine except that any transactions in April 2007 get grouped with any transactions in April 2008, and the same with the rest of the months. Is there any MONTHYEAR function or the like, that differentiates between months from different years?
    Any help would be great!
    Thanks

    1) I believe you need 2 pivot tables
    2) Can you give me more details on which object and which date you are using? I think it should be possible to get the required output.

  • Index year to year in pivot table

    I need to create table and chart as show on picture http://vp.hu.cz/bi2.jpg (sorry numbers are random and displayed sums do net equal to it).
    I dont know how to display indexes (fourth row and last column) in table.
    Indexes in row are: SUM_YEAR_2006/SUM_YEAR_2006, SUM_YEAR_2007/SUM_YEAR_2006, SUM_YEAR_2008/SUM_YEAR_2006
    Indexes in column are: SUM(FACT)_YEAR_2008/SUM(FACT)_YEAR_2007 for every row.
    My second problem is the chart I am not able to display percents in the graph because: In normal table I am not able to get sum for the year. And in pivot table (where the percents is not difficult) I am not able to build chart like the picture.
    ATENTION: The time interval is not every the whole year and then I can't use level based measures ....
    Thank you

    Not sure but you can use Javascript with clientlistener to know which key has been pressed or mouse click
    check this blog entry it shows how to display LOV on F9 key you can take the same logic but with other key
    http://baigsorcl.blogspot.com/2010/06/display-lov-on-f9-key-in-oracle-adf.html

  • Excel Pivot Table with Date Hierarchies - query performance degradation

    For the sake of this explanation, I’m going to try and keep it simple. Slicing the data by additional dimensions only makes the issue worse. I’ll keep this description to one fact table and three dimensions. Also, I’m fairly new to SSAS Tabular; I’ve worked
    with SSAS Multidimensional in the past.
    We’ve got a fact table that keeps track of bill pay payments made over time. Currently, we only have about six months of data, with the fact row count at just under 900,000 rows. The grain is daily.
    There is an Account dimension (approx. 460,000 rows), with details about the individual making a payment.
    There is a Payment Category dimension (approx.. 35,000 rows), which essentially groups various Payees into groups which we like to report on: Automobile Loan, Mortgage, Insurance, etc.
    There is the requisite Date dimension  (exactly 62093 rows-more days than we need?), which allows visibility as to what is being paid when.
    Using this DW model, I’ve created a SSAS BISM Tabular model, from which Excel 2010 is ultimately used to perform some analysis, using Pivot Tables. In the tabular model, for easier navigation (doing what I’ve always done in SSAS MultiDimensional), I’ve created
    several Date Hierarchies, Year-Month, Year-Quarter-Month, etc.
    There are currently only two measures defined in the Tabular model: one for the “Sum of PaymentAmount”; one for the “PaymentsProcessed”.
    OK, in Excel 2010, using a Pivot Table, drag the “Sum of PaymentAmount” measure to the Values section, next to/under the PivotTable Field List. Not too exciting, just the grand total of all Payments, for all time.
    Drag the “YearMonth” hierarchy (from the Date dimension) to the “Column Labels” section. After expanding the year hierarchy to see the months, now the totals are for each of the months, for which we have data, for June through November, 2013.
    Drag the “PaymentCategory” (from the Payment Categories dimension) to the “Report Filter” section. Filter accordingly: We just want to see the monthly totals for “Automobile Loans”.
    Now, some details. Drag the “AccountSK” (hiding the actual account numbers) to the “Row Labels” section. This shows all accounts that have made Automobile Loan payments over the last six months, showing the actual payment amounts.
    So far, so good. Remember, I’m using a Date Hierarchy here, in this case “YearMonth”
    Now, if any of the other attributes on the Account dimension table, say “CreditScore”, or “LongName”, are subsequently dragged over to the “Row Lables” section, under the “AccountSK”, the results will never come back, before timing out or by giving up and
    pressing ESCape!
    If this exact scenario is done by removing the Date Hierarchy, “YearMonth” from the “Column Labels” and replace it with “Year” and “MonthName” attributes from the Date dimension, these fields not being in any sort of hierarchy, adding an additional “Account”
    attribute does not cause any substantial delay.
    What I’m trying to find out is why is this happening? Is there anything I can do as a work around, other than what I’ve done by not using a Date Hierarchy? Is this a known issue with DAX and the query conversion to MDX? Something else?
    I’ve done a SQL Profiler trace, but I’m not sure at this point what it all means. In the MDX query there is a CrossJoin involved. There are also numerous VertiPaq Scans which seems to be going through each and every AccountSK in the Account dimension, not
    just the ones filtered, to get an additional attribute (About 3,600 accounts which are “Automobile Loan” payments.).
    Any thoughts?
    Thanks! Happy Holidays!
    AAO

    Thanks for your reply Marco. I've been reading your book, too, getting into Tabular.
    I've set up the Excel Pivot Table using either the Year/MonthName levels, or the YearMonth hierarchy and then adding the additional attribute for the CreditScore.
    Incidentally, when using the YearMonth hierarchy and adding the CreditScore, all is well, if the Year has not been "opened". When this is done, I suspect the same thing is going on.
    From SQL Profiler, each of the individual MDX queries below (formatted a bit for readability).
    Thanks!
    // MDX query using separate Year and MonthName levels, NO hierarchy.
    SELECT 
    NON EMPTY 
    Hierarchize(
    DrilldownMember(
    CrossJoin(
    {[Date].[Year].[All],[Date].[Year].[Year].AllMembers}, 
    {([Date].[MonthName].[All])}
    ,[Date].[Year].[Year].AllMembers, [Date].[MonthName]
    DIMENSION PROPERTIES PARENT_UNIQUE_NAME,HIERARCHY_UNIQUE_NAME 
    ON COLUMNS, 
    NON EMPTY 
    Hierarchize(
    DrilldownMember(
    CrossJoin(
    {[Accounts].[AccountSK].[All],[Accounts].[AccountSK].[AccountSK].AllMembers}, 
    {([Accounts].[CreditScore].[All])}
    ,[Accounts].[AccountSK].[AccountSK].AllMembers, [Accounts].[CreditScore]
    DIMENSION PROPERTIES PARENT_UNIQUE_NAME,HIERARCHY_UNIQUE_NAME 
    ON ROWS  
    FROM [PscuPrototype] 
    WHERE ([PaymentCategories].[PaymentCategory].&[Automobile Loan],[Measures].[Sum of PaymentAmount]) 
    CELL PROPERTIES VALUE, FORMAT_STRING, LANGUAGE, BACK_COLOR, FORE_COLOR, FONT_FLAGS
    // MDX query using separate YearMonth hierarchy (Year, MonthName).
    SELECT 
    NON EMPTY 
    Hierarchize(
    DrilldownMember(
    {{DrilldownLevel({[Date].[YearMonth].[All]},,,INCLUDE_CALC_MEMBERS)}}, 
    {[Date].[YearMonth].[Year].&[2013]},,,INCLUDE_CALC_MEMBERS
    DIMENSION PROPERTIES PARENT_UNIQUE_NAME,HIERARCHY_UNIQUE_NAME 
    ON COLUMNS,
    NON EMPTY 
    Hierarchize(
    DrilldownMember(
    CrossJoin(
    {[Accounts].[AccountSK].[All],[Accounts].[AccountSK].[AccountSK].AllMembers}, 
    {([Accounts].[CreditScore].[All])}
    ,[Accounts].[AccountSK].[AccountSK].AllMembers, [Accounts].[CreditScore]
    DIMENSION PROPERTIES PARENT_UNIQUE_NAME,HIERARCHY_UNIQUE_NAME 
    ON ROWS  
    FROM [PscuPrototype] 
    WHERE ([PaymentCategories].[PaymentCategory].&[Automobile Loan],[Measures].[Sum of PaymentAmount]) 
    CELL PROPERTIES VALUE, FORMAT_STRING, LANGUAGE, BACK_COLOR, FORE_COLOR, FONT_FLAGS
    AAO

  • Use of LinRegSlope in Pivot Table

    Hi, I am new to OLAP and am having a hard time using the LinRegSlope function on a pivot table. I have a pivot table which pulls data from a server and has "store names" (rows) and "dates" (columns) as the dimensions. i.e.
    [State].[City].[Store] and [year].[month].[date]. The measure being displayed is Revenue.
    I would like to calculate the slope of the "Revenues", such that I could tell whether the revenue on a specifc store is going up or down through a deternimed period of time - only the period being displayed on the table (e.g. 10/10/2014
    through 10/25/2014). I want the slope to appear as a column within the pivot table, and I want it to adjust to the number of stores and dates being displayed at the time (i.e. in the example above the slope should be calculated over a 16 day period because
    there are 16 dates being displayed).
    Any help on the syntax of the function would be greatly appreciated.
    -Jose

    Hi Josemp,
    According to your description, you want to calculate the sales slope from 10/10/2014 to 10/25/2014. Right?
    In Analysis Services, we can use LinRegSlope() function, specify Sales as Y axis value, Date as X axis value. Please refer to the query below:
    WITH
          MEMBER Measures.[Slope] AS
           LINREGSLOPE(LASTPERIODS(16) AS
          [TimeSet],[Measures].[Internet Sales Amount] , RANK([Date].[Fiscal].CurrentMember, [TimeSet]))
    SELECT
          {[Measures].[Slope]} ON COLUMNS,
           {[Date].[Date].&[20051010]:[Date].[Date].&[20051025]}ON ROWS
    FROM
          [Adventure Works]
    If you have any question, please feel free to ask.
    Simon Hou
    TechNet Community Support

  • Pivot Table Report Issue

    Hi,
    I have created a Pivot Table report (I use them all the time in Excel) as one of my rows...I am using a field that is a formula. When I look at the pivot table results there is a sum by this "row category"...all total 1726 items (correct # of total items' but the sum by each of the 4 items is wrong...when I drill (I can only drill from a higher level)...I get the detail of the 1726 items correctly...but if I do a pivot in Excel off the detail I get a different number in the 4 categories (actually the correct summary data)....HOW do I fix this...we really want to use the power of the report...but with such a large error it is difficult to trust the results of the report.
    Report
    Source Type     MAG Created Year     Parent Account     Target Market     # of Accounts
    Marketing     2004     Unspecified     Key Account     2,521
              Quanta Services Inc     Key Account     1
         2005     Unspecified     Key Account     388
              Vipar Heavy Duty     Key Account     29
         2006     Unspecified     Key Account     824
         2007     Unspecified     Key Account     838
              Domino's Pizza     Key Account     9
         2008     Unspecified     Key Account     582
    Marketing                    5,192
    Grand Total                    5,192
    When you drill down...for instance...the data for 2007 Unspecified is 358 NOT 838....
    Please assist!!! ASAP

    It is very difficult to troubleshoot a report without seeing it, but it looks to me like you have a problem with your aggregation rules... each column has an aggregation rule, and a pivot table measure can also have an aggregation rule... sometimes, depending on the formula and columns that make up your formula, the aggregation rules can cause seemingly incorrect totals because the data is aggregated on the table and then re-aggregated on the pivot table.
    If you would like, you may email me directly and I will see if I can help further.
    My email is in my profile.
    Mike L

  • Pivot Table - Calculate Variance - Hidden Fields?

    I need some help adding a target value field inside a pivot table in excel.
    Here is what my current pivot table looks like.
    Regions                  1 year - Actual              1 year - Target??               
    Difference
                       (April 2013 to MArch 2014)                                          
     (Target - Actual)?     
    Region1                $6,355,696.75
    Region2                $6,775,309.87
    Region3                $2,230,424.76
    Regions expand into managers which in turn expand to consultants.
    What I want to do is add a column for target values of the 3 different regions and then create another calculated field that will show the difference between the target and actual values.
    Can this be done without writing any stored procedures in SQL? I want to do this in excel itself.
    The target values are not calculated so can we store them in hidden fields or something in the pivot or excel?

    1. Click anywhere in Pivot and go to Options tab > Formulas > Calculated Field.
    2. Create a calculated field called Target (whatever name your choose). If your target is say 7000000, put this value in Formula field. You may put it with or without =
    3. Now after this, you can once again create a new Calculated Field. Let's say this is Variance. If you variance is Target - Actual, put this as =Target-Actual in Calculated Field.
    4. Your pivot will have whatever you wanted.

  • Excel 2010 Pivot Table VBA Not Refreshing Table

    My company recently upgraded from Excel 2003 to 2010. I had VBA written to take source data and convert it into a number of Pivot Tables on a number of worksheets. It has been working fine for years. After upgrading to 2010 the VBA crashed. I tracked it
    down to the fact that when my code was making changes to the Pivot Tables (changing fields, filters, etc...) the pivot table on the worksheet had no data, but the fields were there. I can manually go to the pivot table and manually refresh and all the data
    comes in.
    So I tried adding the VBA code to refresh the pivot table, but the pivot tables will not refresh with data.
    I tried:
    ActiveSheet.PivotTables("WO Pivot").RefreshTable
    and
    ActiveWorkbook.RefreshAll
    And these did not work.
    I also tried recording a macro for the manual steps to refresh and got:
     ActiveSheet.PivotTables("WO Pivot").PivotCache.Refresh
    This does not work either.
    The PivotTable name is correct, but I tried using the number as well, and the name works for other code manipulating the the pivot table.
    e.g.:
    With ActiveSheet.PivotTables("WOPivot").PivotFields("Task Title")
          .Orientation = xlRowField .Position = 2
          .Subtotals = Array(False, False, False, False, False, False, False, False, False, False, _False, False)
    End
    With Why isn't this working? Is there another way to refresh pivot table data in 2010?
    Thanks. P.S. I've tried formating this so it is readable, but it comes out garbled. Hope this looks better.

    The solution above didn't work for me, but the following did the trick:
    ActiveSheet.PivotTables("WOPivot").PivotCache.Refresh
    By the way, I identified it by recording a macro, then going on the Pivot Table that needed refreshing and pressing F9 to refresh it. The line of VBA code above was the result.
    Cheers,
    Marco.

  • Sorting on a total column or calculated column in a pivot table

    We have a pivot table showing customer activity by month. We have added a calculated field to show the YTD average instead of a total column. Is there a way to sort on this calculated field? We have applied a sort on the measure in the criteria, and our resulting pivot table sorts by the values in the most recent month, not by the YTD average.

    I think we cant sort when we use a pivot view becoz all the rows are already fixed. Say your rows are sales and volume and columns are year 2007 and 2008, imagine if you r given the sorting ability then if number of units solds is more then it need to change the rows (but in pivot table rows are fixed). So, we cant sort in pivot tables!!

  • Report in Pivot table

    Hi All,
    I have a "month" column in the column section of Pivot table. I want to put Year as a prompt.
    I want the request this way,
    When I select Year (for example 2010) from the Year Prompt, I should get result starting from Jan-2010 to Jan-2011..
    How could that be don?
    This is how my request looks like
    -------------------|-Jan2010-|--Feb2010------- and so on upto --------Dec2010
    Count(claims)-|----10------|

    hi,
    hi save ur filter value in a presentation variable.
    create a dummy report with only one column and add your time column to it. in the fx give timestampadd(sql_tsi_month, 1, column) and create a filter for the column with column=presentaion variable. make sure in the filter the fx is only the column name not with the timestampadd fn.
    now in your original report go to your time column filter and in the advance filter tab, selct ur dummy table results. and create another filter with "or" clause with the previous one and make column_year=presentaioon variable. hope this works.

  • Modify Pivot Table in BI Publisher Template

    Hi,
    I've a crosstab report requirement in BI Publisher. Suppose I've 2 row-items, 1 column-item(Month) and 3 datapoints. In BI publisher template builder->pivot table wizard I found only option is there to display datapoint columns one after another vertically. So for each Month(column item) 3 columns are coming, total no. of columns for data points: 12x3=36 + 3 Total columns; ie total 39 columns. Also for two row-items 2 columns are coming. So all together in one sheet 41 columns are coming and it has become difficult to manage.
    Hence, I want to display the datapoint columns one above another, so that 13 column only (12 columns for datapoints + 1 column for Total) come instead of 39 columns.
    Please let me know how can it be done from BI-publisher template builder. Simple XML source taken from a table is used behind this template. Can the requirement be achieved by modifying XML source format or XSL-FO output taken from the template? Please help.
    Regards..

    Insert a table with 3 columns and 2 rows..
    split the (2,2) cell into 3 rows and (2,3) cell into 3 rows..
    table cell (1,1)<?horizontal-break-table:1?>
    (1,2)Sales
    (1,3)<?for-each-group@column:SALE;./YEAR?><?YEAR?><?end for-each-group?>
    (2,1)<?for-each-group:SALE;./REGION?><?variable@incontext:G1;current-group()?><?REGION?>
    (2,2) 1st row Software
            2nd row Hardware
            3rd row Services
    (2,3) 1st row<?for-each-group@cell://SALE;./YEAR?><?sum ($G1[(./YEAR=current()/YEAR)]/SOFTWARE)?><?end for-each-group?>
    2st row<?for-each-group@cell://SALE;./YEAR?><?sum ($G1[(./YEAR=current()/YEAR)]/HARDWARE)?><?end for-each-group?>
    3rd row<?for-each-group@cell://SALE;./YEAR?><?sum ($G1[(./YEAR=current()/YEAR)]/SERVICES)?><?end for-each-group?><?end for-each-group?>the xml file I used was mentioned in tim's blog in the previous reply of mine...I tried it and I got the desired o/p..
    Edited by: user10280715 on Apr 8, 2009 8:58 AM

  • How to replace null as 0 in  obiee11g pivot table view?

    Hi,
    I am using obiee11g pivot table view,
    I have tried so many views but it's not work. My oracle support team also tired but could not solve it
    1.) used BIN method is that measure columns
    2.) ifnull(column name,0)
    3.) case condition:
    Case when columns is NULL then 0 else column end
    4) data formate override custom formate option
    It seems that the syntax for this custom format is positive-value-mask (semi colon) negative-value-mask (semi colon) null-mask. So this means we have a few options.
    E.g. if you want zeros (0) instead of null then enter:
    #,##0;-#,##0;0
    http://obieeelegant.blogspot.com/2011/06/how-to-replace-null-values-in-obiee.html
    Note:
    I don't want to show strike-rate and custom message in that blank cell. I want to show blank cell(null values) as 0 in the obiee11g pivot table view.
    Obiee10g version is working fine only issues in obiee11g
    Thanks in advance...
    Thanks
    Deva

    I tried this on 11.1.1.6.2 but I can't see good results.
    I choose subject area A-Sample Sales and I choose:
    T02 per Name Month on rows
    P1 Product on columns
    Measure : IFNULL("Simple Calculations"."17 Net Costs", 0)
    Prompted Year 2008
    On product Install and 2008/01 there isn't value...and I put Ifnull in my formula...
    My problem is that I want to do a conditional format when Product = Install. So I have all column with background colour except Null values...so is not pretty...
    If I add custom numeric format I can see 0 but not with background colour...
    I add a picture:
    http://imageshack.us/photo/my-images/600/tablegk.jpg/
    Any help about it??
    Is a bug on obiee??
    Edited by: Alex1 on 04-sep-2012 4:28

  • How to export the created Pivot table by using Power Pivot into separate excel file in the same format?

    Hi PowerPivot experts,
    I have created more than 60 pivot tables in multiple sheets by using PowerPivot work book. now i want delivery all the pivot table in excel document to my end user by email.
    I want send only the Pivot tables which i created using PowerPivot data model instead of sending the whole model file since its very heavy.
    I have tried with export option in Excel 97-2003, its works fine but not getting exact pivot format which i created and its displays as value.
    My aim to send pivot table that i created format but not whole file with source data.
    I would be really grateful if advise me to fix it out.

    Hi Robert,
    I don't think it is a good idea to deliver all PivotTable report to end user via E-mail, and SQL Server PowerPivot for Excel doesn't support to deliver PivotTable report to end user without PowerPivot data inside in the data model. For example, I suppose
    we create a PivotTable to display the SalesAmount of US in pervious years(eg:2012, 2013, 2014), how can we dynamic show the value based on end user selection without PowerPivot data model data(The PivotTable report don't have data source)?
    So, one workaround that we can create a shared folder to store all of PowerPivot report for all of end user in the domain environment, and then inform end users to copy the PowerPivot reports what they want via E-mail.
    If the end users aren't in domain environment, we can implement the VPN soltion to achieve this.
    Regards,
    Elvis Long
    TechNet Community Support

  • Using Axis(1), gives error "Slicer Axis cannot be referenced" in excel pivot table, but works fine ssms

    Hi .. I am using Axis(1) to select all the retrieved records. The MDX query looks like-
    WITH MEMBER [Measures].[New Opportunity Count]
     AS SUM(
             {DESCENDANTS(
              [Opportunity].[Opportunity].CURRENTMEMBER,
              1
            iif([Measures].[Opportunity Sales Days - Invisible] > 0,1,0)
     //HAVING [Measures].[New Opportunity Count] = 1
     MEMBER [Measures].[Latest Opportunity Count]
     AS SUM(
          EXCEPT( AXIS(1),
                    [Opportunity].[Opportunity].[All]
                 ),[Measures].[New Opportunity Count])
    MEMBER [Measures].[Opportunity Sales Days]
    AS iif([Measures].[New Opportunity Count] =0,0,
          iif([Opportunity].[Opportunity].CURRENTMEMBER.MEMBER_KEY =[Opportunity].[Opportunity].[All].MEMBER_KEY,
            (SUM(
                EXCEPT(AXIS(1),
                    [Opportunity].[Opportunity].[All]
                 ),[Measures].[Opportunity Sales Days - Invisible])/[Measures].[Latest Opportunity Count]),
            [Measures].[Opportunity Sales Days - Invisible]/[Measures].[New Opportunity Count])
    SELECT 
      [Measures].[Latest Opportunity Count],
      [Measures].[New Opportunity Count],
      [Measures].[Opportunity Sales Days]
    }ON COLUMNS,
        [Opportunity].[Opportunity].&[{140D9883-6F49-E011-AEA0-00155D032A00}],
        [Opportunity].[Opportunity].&[{3A2BB124-EE85-E011-8A06-00155D032A00}],
        [Opportunity].[Opportunity].&[{60036FE8-DC48-E111-975F-00155D032A00}],
        [Opportunity].[Opportunity].&[{CA158EE5-C445-E111-975F-00155D032A00}],
        [Opportunity].[Opportunity].&[{B69F83EB-832D-E211-9861-00155D032A00}],
        [Opportunity].[Opportunity].&[{D500AE90-606C-E211-83AD-00155D03570D}],
        [Opportunity].[Opportunity].[All]
    //      [Opportunity].[Opportunity].members
    ON ROWS
    FROM [IMGROUP Base]
    It works fine in SSMS editor, but while trying to access the same query from Excel pivot table, it gives the error : "Slicer axis cannot be referenced". I have taken the MDX query from excel and it looks like -
    SELECT NON EMPTY Hierarchize({DrilldownLevel({[Opportunity].[Opportunity Hierarchy].[All]},,,INCLUDE_CALC_MEMBERS)}) DIMENSION PROPERTIES PARENT_UNIQUE_NAME,HIERARCHY_UNIQUE_NAME,[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity Account Manager],[Opportunity].[Opportunity
    Hierarchy].[Opportunity].[Opportunity Actual Close Date Time],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity Age In Days],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity Close Date],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity
    Created On Date],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity Created On Date Time],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity Days In Sales Stage],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity Delivery
    Owner],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity Estimated Close Date],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity Estimated Project Duration In Days],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity
    Estimated Project Duration In Months],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity Estimated Project Duration In Working Days],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity Estimated Project End Date],[Opportunity].[Opportunity
    Hierarchy].[Opportunity].[Opportunity Estimated Project First Working Day Date],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity Estimated Project Last Working Day Date],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity Estimated
    Project Start Date],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity Latest News],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity Latest News Updated On Date Time],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity
    Lost Competitor],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity Originating Lead Name],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity Owning Organisation],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity
    Revenue Spread],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity Sales Assist],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity Sales Assist-Hidden],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity Sales Stage],[Opportunity].[Opportunity
    Hierarchy].[Opportunity].[Opportunity Sales Stage Updated On Date Time],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity Source Full Name],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity State],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity
    Sub Source],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity Updated On Date Time],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity Won Lost Description],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity Won Lost
    Reason] ON COLUMNS  FROM (SELECT ({[Opportunity].[Opportunity Hierarchy].[Opportunity].&[{B69F83EB-832D-E211-9861-00155D032A00}], [Opportunity].[Opportunity Hierarchy].[Opportunity].&[{CA158EE5-C445-E111-975F-00155D032A00}], [Opportunity].[Opportunity
    Hierarchy].[Opportunity].&[{60036FE8-DC48-E111-975F-00155D032A00}], [Opportunity].[Opportunity Hierarchy].[Opportunity].&[{3A2BB124-EE85-E011-8A06-00155D032A00}], [Opportunity].[Opportunity Hierarchy].[Opportunity].&[{140D9883-6F49-E011-AEA0-00155D032A00}]})
    ON COLUMNS  FROM [IMGROUP Base]) WHERE ([Measures].[Opportunity Sales Days]) CELL PROPERTIES VALUE, FORMAT_STRING, LANGUAGE, BACK_COLOR, FORE_COLOR, FONT_FLAGS
    Any help, will be greatly apreciated.
    Sayan.

    Sorry, it was a mistake in my query. Now I have corrected each of them and individually each of them works fine. See below-
    CREATE MEMBER CURRENTCUBE.[Measures].[New Opportunity Count]
     AS SUM(
             {DESCENDANTS(
              [Opportunity].[Opportunity].CURRENTMEMBER,
              1
            iif([Measures].[Opportunity Sales Days - Invisible] > 0,1,0)
    VISIBLE = 0 , 
    ASSOCIATED_MEASURE_GROUP = 'Opportunity';  
    CREATE MEMBER CURRENTCUBE.[Measures].[Latest Opportunity Count]
     AS SUM(
          EXCEPT(Axis(0),
                   [Opportunity].[Opportunity Hierarchy].[All]
                 ),[Measures].[New Opportunity Count]), 
    VISIBLE = 0 , 
    ASSOCIATED_MEASURE_GROUP = 'Opportunity';  
    CREATE MEMBER CURRENTCUBE.[Measures].[Opportunity Sales Days]
    AS iif([Measures].[New Opportunity Count] =0,0,
          iif([Opportunity].[Opportunity].CURRENTMEMBER.MEMBER_KEY =[Opportunity].[Opportunity].[All].MEMBER_KEY,
            (SUM(
                EXCEPT(AXIS(0),
                  [Opportunity].[Opportunity Hierarchy].[All]
                 ),[Measures].[Opportunity Sales Days - Invisible])/[Measures].[Latest Opportunity Count]),
            [Measures].[Opportunity Sales Days - Invisible]/[Measures].[New Opportunity Count])
    VISIBLE = 1,  
    DISPLAY_FOLDER = 'Days',  
    ASSOCIATED_MEASURE_GROUP = 'Opportunity';  
    CREATE MEMBER CURRENTCUBE.[Measures].[Opportunity Actual Value Home Currency New]
     AS  SUM(
             {DESCENDANTS(
              [Opportunity].[Opportunity].CURRENTMEMBER,
              1
            iif([Measures].[Opportunity Sales Days] > 0,[Measures].[Opportunity Actual Value Home Currency],0)
    VISIBLE = 0,  
    ASSOCIATED_MEASURE_GROUP = 'Opportunity'  ; 
    CREATE MEMBER CURRENTCUBE.[Measures].[Opportunity Actual Revenue Per Sales Day]
    AS iif([Measures].[Opportunity Actual Value Home Currency New] =0,0,
          iif([Opportunity].[Opportunity Hierarchy].CURRENTMEMBER.MEMBER_KEY =[Opportunity].[Opportunity Hierarchy].[All].MEMBER_KEY,
            (SUM(
              EXCEPT( AXIS(0),
                    [Opportunity].[Opportunity Hierarchy].[All]
                 ),[Measures].[Opportunity Actual Value Home Currency New])/[Measures].[Opportunity Sales Days]),
            ([Measures].[Opportunity Actual Value Home Currency New]/[Measures].[Opportunity Sales Days]))
    FORMAT_STRING = "£#,##0.00;-£#,##0.00;#",
    VISIBLE = 1,
    DISPLAY_FOLDER = 'Financial',
    ASSOCIATED_MEASURE_GROUP = 'Opportunity';  
    But, when I want to select them together from Excel, I am geeing the below error-
    CellOrdinal 0
    VALUE #Error MdxScript(IMGROUP Base) (1436, 7) Members, tuples or sets must use the same hierarchies in the EXCEPT function.
    FORMAT_STRING £#,##0.00;-£#,##0.00;#
    LANGUAGE (null)
    BACK_COLOR (null)
    FORE_COLOR (null)
    FONT_FLAGS (null)
    The generated MDX in Excel as -
    SELECT {[Measures].[Opportunity Actual Revenue Per Sales Day],[Measures].[Opportunity Sales Days]} DIMENSION PROPERTIES PARENT_UNIQUE_NAME,HIERARCHY_UNIQUE_NAME ON COLUMNS , NON EMPTY Hierarchize({DrilldownLevel({[Opportunity].[Opportunity Hierarchy].[All]},,,INCLUDE_CALC_MEMBERS)})
    DIMENSION PROPERTIES PARENT_UNIQUE_NAME,HIERARCHY_UNIQUE_NAME,[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity Account Manager],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity Actual Close Date Time],[Opportunity].[Opportunity
    Hierarchy].[Opportunity].[Opportunity Age In Days],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity Close Date],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity Created On Date],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity
    Created On Date Time],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity Days In Sales Stage],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity Delivery Owner],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity Estimated
    Close Date],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity Estimated Project Duration In Days],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity Estimated Project Duration In Months],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity
    Estimated Project Duration In Working Days],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity Estimated Project End Date],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity Estimated Project First Working Day Date],[Opportunity].[Opportunity
    Hierarchy].[Opportunity].[Opportunity Estimated Project Last Working Day Date],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity Estimated Project Start Date],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity Latest News],[Opportunity].[Opportunity
    Hierarchy].[Opportunity].[Opportunity Latest News Updated On Date Time],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity Lost Competitor],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity Originating Lead Name],[Opportunity].[Opportunity
    Hierarchy].[Opportunity].[Opportunity Owning Organisation],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity Revenue Spread],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity Sales Assist],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity
    Sales Assist-Hidden],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity Sales Stage],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity Sales Stage Updated On Date Time],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity
    Source Full Name],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity State],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity Sub Source],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity Updated On Date Time],[Opportunity].[Opportunity
    Hierarchy].[Opportunity].[Opportunity Won Lost Description],[Opportunity].[Opportunity Hierarchy].[Opportunity].[Opportunity Won Lost Reason] ON ROWS  FROM (SELECT ({[Opportunity].[Opportunity Hierarchy].[Opportunity].&[{B69F83EB-832D-E211-9861-00155D032A00}],
    [Opportunity].[Opportunity Hierarchy].[Opportunity].&[{60036FE8-DC48-E111-975F-00155D032A00}], [Opportunity].[Opportunity Hierarchy].[Opportunity].&[{3A2BB124-EE85-E011-8A06-00155D032A00}], [Opportunity].[Opportunity Hierarchy].[Opportunity].&[{E2E48CB7-8463-E411-831D-00155D035708}],
    [Opportunity].[Opportunity Hierarchy].[Opportunity].&[{140D9883-6F49-E011-AEA0-00155D032A00}]}) ON COLUMNS  FROM [IMGROUP]) CELL PROPERTIES VALUE, FORMAT_STRING, LANGUAGE, BACK_COLOR, FORE_COLOR, FONT_FLAGS
    Any help?
    sayan maity

Maybe you are looking for