Creating View or  Pivot Table

I have a query:
SELECT circ.facilityid
FROM ADMGID.CIRCUITSOURCE_DB CIRC,
ADMGID.MINIRETICULATED_DB MN
WHERE CIRC.DISTGRP_FID = MN.DISTGRP_FID
AND Mn.Facilityid = 'NBRG 0002 0009'
return me data , ever 4 rows
BRG 0207
BRG 0210
BRG 0208
BRG 0209
of course when change Mn.Facilityid change rows
I want that this rows show me as Columns , or to create a view thar return this columns

this examples might be of help.
SQL> select * from pivot_tab;
      COL1 COL2
         1 a
         1 b
         1 c
         2 h
         2 h
SQL>
SQL>
SQL> select p.col1,
  2         substr(max(substr(sys_connect_by_path (p.col2,','),2)),1,60)
  3         as col2
  4    from (select col1,
  5                 col2,
  6                 row_number() over (partition by col1 order by col1, col2) rn
  7            from pivot_tab) p
  8  start with p.rn = 1
  9  connect by p.rn = prior p.rn + 1
10  and prior p.col1 = p.col1
11  group by col1;
      COL1 COL2
         1 a,b,c
         2 h,h
SQL>

Similar Messages

  • Trouble Creating View on External Table in Diff Schema

    I am unable to create a view in a different schema on an external table in a different schema, even when I am connected to my database as SYS as SYSDBA.
    CREATE VIEW WH1.EXT1VIEW AS SELECT * FROM WH1.EXT1VIEW;
    returns the error:
    ORA-06564: object ER_ADMIN_DIR does not exist
    I created a directory:
    CREATE DIRECTORY ER_ADMIN_DIR AS 'C:\ER_Init';
    Granted privs:
    grant read,write on directory ER_ADMIN_DIR to public;
    Created the external table EXT1 in a different schema WH1:
    CREATE TABLE WH1.EXT1 (TABLE_NAME VARCHAR2(100), COLUMN_NAME VARCHAR2(100))
    ORGANIZATION EXTERNAL (TYPE ORACLE_LOADER DEFAULT DIRECTORY SYS.ER_ADMIN_DIR
    ACCESS PARAMETERS
    (RECORDS DELIMITED BY NEWLINE
    FIELDS TERMINATED BY ','
    MISSING FIELD VALUES ARE NULL
    LOCATION ('FILE1.TXT')
    REJECT LIMIT UNLIMITED;
    I can query from the table successfully connected as SYS:
    SQL> select count(*) from wh1.ext1;
    1008
    1 row selected.
    However when I try to create a view on that table connected as SYS:
    CREATE VIEW WH1.EXT1VIEW AS SELECT * FROM WH1.EXT1VIEW;
    I get the following error:
    ORA-06564: object ER_ADMIN_DIR does not exist
    I can connect over to the WH1 schema and create the view successfully, however due to a specific situation I need to be able to create the view from the SYS schema. I can create the view FORCE and it creates with compilation errors, however the view cannot be compiled successfully from SYS.
    Is there a known bug on creating views on external tables remotely?
    Thanks for any help!
    Tina

    I have been able to reproduce your error, using scott instead of sys, and resolve it, as demonstrated below. The combination that I found that worked consisted of having wh1 grant select on ext1 to scott explicitly and using set current_schema to wh1, so that ext1view did not require the wh1 qualifier.
    scott@ORA92> CREATE USER wh1 IDENTIFIED BY wh1
      2  /
    User created.
    scott@ORA92> GRANT CONNECT, RESOURCE TO wh1
      2  /
    Grant succeeded.
    scott@ORA92> CREATE OR REPLACE DIRECTORY er_admin_dir AS 'c:\er_init'
      2  /
    Directory created.
    scott@ORA92> CREATE TABLE wh1.ext1
      2    (table_name  VARCHAR2(100),
      3       column_name VARCHAR2(100))
      4  ORGANIZATION EXTERNAL
      5    (TYPE ORACLE_LOADER
      6       DEFAULT DIRECTORY er_admin_dir
      7       ACCESS PARAMETERS
      8         (RECORDS DELIMITED BY NEWLINE
      9          FIELDS TERMINATED BY ','
    10          MISSING FIELD VALUES ARE NULL)
    11       LOCATION ('file1.txt'))
    12  REJECT LIMIT UNLIMITED
    13  /
    Table created.
    scott@ORA92> CREATE OR REPLACE VIEW wh1.ext1view AS SELECT * FROM wh1.ext1
      2  /
    CREATE OR REPLACE VIEW wh1.ext1view AS SELECT * FROM wh1.ext1
    ERROR at line 1:
    ORA-06564: object ER_ADMIN_DIR does not exist
    scott@ORA92> CONNECT wh1/wh1
    Connected.
    scott@ORA92> @ LOGIN
    scott@ORA92> SET ECHO OFF
    GLOBAL_NAME
    [email protected]2
    wh1@ORA92> GRANT SELECT ON ext1 TO scott
      2  /
    Grant succeeded.
    wh1@ORA92> CONNECT scott/tiger
    Connected.
    wh1@ORA92> @ LOGIN
    wh1@ORA92> SET ECHO OFF
    GLOBAL_NAME
    [email protected]A92
    scott@ORA92> ALTER SESSION SET CURRENT_SCHEMA = wh1
      2  /
    Session altered.
    scott@ORA92> CREATE OR REPLACE VIEW ext1view AS SELECT * FROM wh1.ext1
      2  /
    View created.
    scott@ORA92> ALTER SESSION SET CURRENT_SCHEMA = scott
      2  /
    Session altered.
    scott@ORA92> SELECT * FROM wh1.ext1view
      2  /
    TABLE_NAME
    ---------------------------------------------------------COLUMN_NAME
    ---------------------------------------------------------tab1
    col1
    tab2
    col2
    scott@ORA92>

  • Error Creating View on External Table

    I create my oracle directory connected as SYS as SYSDBA and grant read,write to public:
    CREATE OR REPLACE DIRECTORY ER_ADMIN_DIR AS 'C:\win32app\ingr\ER\ER_Init\scripts';
    grant read,write on directory ER_ADMIN_DIR to public;
    I creat my external table from SYS to reside in another schema called DRTEST:
    CREATE TABLE DRTEST.SPEC_REQUIRED (TABLE_NAME VARCHAR2(100), COLUMN_NAME VARCHAR2(100))
    ORGANIZATION EXTERNAL (TYPE ORACLE_LOADER DEFAULT DIRECTORY ER_ADMIN_DIR
    ACCESS PARAMETERS
    (RECORDS DELIMITED BY NEWLINE
    FIELDS TERMINATED BY ','
    MISSING FIELD VALUES ARE NULL
    LOCATION ('atts_in_red.tx')
    REJECT LIMIT UNLIMITED ;
    I can select from the table and all is good at this point.
    However, I get an error when I try to create a view (in DRTEST from SYS) based on the external table.
    CREATE VIEW DRTEST.MYVIEW1 AS SELECT * FROM DRTEST.SPEC_REQUIRED;
    CREATE VIEW DRTEST.MYVIEW1 AS SELECT * FROM DRTEST.SPEC_REQUIRED
    ERROR at line 1:
    ORA-06564: object ER_ADMIN_DIR does not exist
    (note I'm still connected as SYS as SYSDBA here)
    I can create the view if I connect to DRTEST and run the exact same create view statement there. Is there something in Oracle that prevents me from doing this from the SYS account? I usually think of SYS as having the "Power of God to do all things".
    I have to create the external table and view on several schema's and I don't want the user to have to connect to each schema separately.
    Tina

    Tina,
    I think you are facing bug 2948123 (CREATE VIEW ON EXTERNAL TABLE ORA-6564). The workaround is to connect (in your case) as user DRTEST and then perform the CREATE VIEW statement (you tested this already). Or (according to the bug description) create the view under the SYS schema itself.

  • How to create view for xmltype table in oracle

    hi:
    Can some one help me how to create view for xmltype table in oracle?
    XMLType do not have column
    Sem

    Thank you !!
    I read it and become very hard to implement what I want to do.
    Can you give me example please?
    My main goal to create view for xmltype table is to XQuery the XML data?
    Do you have any other suggestion?
    Please help
    Ali_2

  • OBIEE 11g - How to create clean looking pivot tables

    Hi, does anyone have a good way to clean up the appearance of pivot tables in OBIEE 11g? I'm a big fan of Stephen Few and firmly believe in the "minimize non-data ink" theory. Unfortunately, there seems to be a lot of stuff on OBIEE pivots that I can't easily clean up. Does anyone have ideas for:
    1. How to remove the "gray" / "beige" coloring from column and row dimension? I opened a ticket with Oracle 6 months ago, and basically they've just responded that it is a "enhancement request" for a future version (aka not going to see it for a LONG time)
    2. For my "across" dimension, I don't seem to have a good way to show the dimension name. There is an option under "column properties" to "display heading" - but when this is turned on it scrunches the heading up directly over the column that has the down dimension members. I really want this to go across the pivot.
    Any help on this would be greatly appreciated.
    Thanks!
    Scott

    Hi,
    Steps,
    Just create DSN (odbc connection for the excel data source) then try to import via rpd that time u must need to select "System Tables"
    For more steps,
    http://allaboutobiee.blogspot.com/2012/03/excel-as-data-source-in-obiee.html
    http://oraclebi.blog.com/working-with-excel-datasource-in-obiee
    http://www.ascentt.com/2012/01/importing-excel-file-into-obiee-11g
    http://obiee101.blogspot.com/2008/06/obiee-excel-import-prepping-data.html
    Note: user id and password u can set it u r own and need to be updated in your connection pool alos else u can go with empty user id and password
    Thanks
    Deva

  • Horizontal view in Pivot Table

    Hi,
    I'm new to OBIEE,We have 2 dim columns(i.e..,Vendor Name,month) and 4 measure fact columns (i.e.,Qty, Qty received,Qty Canceled and Amount).
    My requirement is based vendor name data should be displayed.
    In report i pull the columns and vendor name has been promoted but client required only measure columns in following format.I was try in by using pivot view but unable set this.
    How achive this.Please let me know.
    Format:
    Month---------- -- Jan-Feb-mor- April
    Qty--------------------- 10- 12 - 10 - 22
    Qty received----------8- 10- 8- 20
    Qty Canceled---------2- 2 - 2- -2
    Amount--------------100-200-300-500

    Hi,
    By default there is no feature like that. only way you have to customize java script(work around) method and solve it.
    Refer the below link
    http://obiee101.blogspot.com/2010/01/obiee-horizontal-pivot-sections-part-2.html
    Re: Pivot Table - horizontal layout
    Thanks
    Deva

  • Creating View for a table with parent child relation in table

    I need help creating a view. It is on a base table which is a metadata table.It is usinf parent child relationship. There are four types of objects, Job, Workflow, Dataflow and ABAP dataflow. Job would be the root parent everytime. I have saved all the jobs
    of the project in another table TABLE_JOB with column name JOB_NAME. Query should iteratively start from the job and search all the child nodes and then display all child with the job name. Attached are the images of base table data and expected view data
    and also the excel sheet with data.Picture 1 is the sample data in base table. Picture 2 is data in the view.
    Base Table
    PARENT_OBJ
    PAREBT_OBJ_TYPE
    DESCEN_OBJ
    DESCEN_OBJ_TYPE
    JOB_A
    JOB
    WF_1
    WORKFLOW
    JOB_A
    JOB
    DF_1
    DATAFLOW
    WF_1
    WORKFLOW
    DF_2
    DATAFLOW
    DF_1
    DATAFLOW
    ADF_1
    ADF
    JOB_B
    JOB
    WF_2
    WORKFLOW
    JOB_B
    JOB
    WF_3
    WORKFLOW
    WF_2
    WORKFLOW
    DF_3
    DATAFLOW
    WF_3
    WORKFLOW
    DF_4
    DATAFLOW
    DF_4
    DATAFLOW
    ADF_2
    ADF
    View
    Job_Name
    Flow_Name
    Flow_Type
    Job_A
    WF_1
    WORKFLOW
    Job_A
    DF_1
    DATAFLOW
    Job_A
    DF_2
    DATAFLOW
    Job_A
    ADF_1
    ADF
    Job_B
    WF_2
    WORKFLOW
    Job_B
    WF_3
    WORKFLOW
    Job_B
    DF_3
    DATAFLOW
    Job_B
    DF_4
    DATAFLOW
    Job_B
    ADF_2
    ADF
    I implemented the same in oracle using CONNECT_BY_ROOT and START WITH.
    Regards,
    Megha

    I think what you need is recursive CTE
    Consider your table below
    create table basetable
    (PARENT_OBJ varchar(10),
    PAREBT_OBJ_TYPE varchar(10),
    DESCEN_OBJ varchar(10),DESCEN_OBJ_TYPE varchar(10))
    INSERT basetable(PARENT_OBJ,PAREBT_OBJ_TYPE,DESCEN_OBJ,DESCEN_OBJ_TYPE)
    VALUES('JOB_A','JOB','WF_1','WORKFLOW'),
    ('JOB_A','JOB','DF_1','DATAFLOW'),
    ('WF_1','WORKFLOW','DF_2','DATAFLOW'),
    ('DF_1','DATAFLOW','ADF_1','ADF'),
    ('JOB_B','JOB','WF_2','WORKFLOW'),
    ('JOB_B','JOB','WF_3','WORKFLOW'),
    ('WF_2','WORKFLOW','DF_3','DATAFLOW'),
    ('WF_3','WORKFLOW','DF_4','DATAFLOW'),
    ('DF_4','DATAFLOW','ADF_2','ADF')
    ie first create a UDF like below to get hierarchy recursively
    CREATE FUNCTION GetHierarchy
    @Object varchar(10)
    RETURNS @RESULTS table
    PARENT_OBJ varchar(10),
    DESCEN_OBJ varchar(10),
    DESCEN_OBJ_TYPE varchar(10)
    AS
    BEGIN
    ;With CTE
    AS
    SELECT PARENT_OBJ,DESCEN_OBJ,DESCEN_OBJ_TYPE
    FROM basetable
    WHERE PARENT_OBJ = @Object
    UNION ALL
    SELECT b.PARENT_OBJ,b.DESCEN_OBJ,b.DESCEN_OBJ_TYPE
    FROM CTE c
    JOIN basetable b
    ON b.PARENT_OBJ = c.DESCEN_OBJ
    INSERT @RESULTS
    SELECT @Object,DESCEN_OBJ,DESCEN_OBJ_TYPE
    FROM CTE
    OPTION (MAXRECURSION 0)
    RETURN
    END
    Then you can invoke it as below
    SELECT * FROM dbo.GetHierarchy('JOB_A')
    Now you need to use this for every parent obj (start obj) in view 
    for that create view as below
    CREATE VIEW vw_Table
    AS
    SELECT f.*
    FROM (SELECT DISTINCT PARENT_OBJ FROM basetable r
    WHERE NOT EXISTS (SELECT 1
    FROM basetable WHERE DESCEN_OBJ = r.PARENT_OBJ)
    )b
    CROSS APPLY dbo.GetHierarchy(b.PARENT_OBJ) f
    GO
    This will make sure it will give full hieraracy for each start object
    Now just call view as below and see the output
    SELECT * FROM vw_table
    Output
    PARENT_OBJ DESCEN_OBJ DESCEN_OBJ_TYPE
    JOB_A WF_1 WORKFLOW
    JOB_A DF_1 DATAFLOW
    JOB_A ADF_1 ADF
    JOB_A DF_2 DATAFLOW
    JOB_B WF_2 WORKFLOW
    JOB_B WF_3 WORKFLOW
    JOB_B DF_4 DATAFLOW
    JOB_B ADF_2 ADF
    JOB_B DF_3 DATAFLOW
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Creat View from Multiple tables , Multiple Select

    Hello  Everyone ,
    I have a question and am not sure if this the correct forum to post it .
    I have two table studentTable and CourseTable which is each student  take more than one course . 1:M
    for example Student1 take 2 courses (C1 ,  C2).
    Student2 take 3 courses (C1,C2, C3).
    I need to create a table/View that contain student information plus all the courses and the score for each  course in one row.
    for example
    Row1= Student1_Id ,C1_code ,C1_name  ,C1_Score ,C2_code,C2_name ,C2_Score
    Row2=
    Student2_Id,C1_code,  C1_name,C1_Score,C2_code ,C2_name ,C2_Score ,  C3_code,C3_name,C3_Score
    and since Student 1 just took two courses  , I  should enter NULL in 'Course 3 fields'
    My Struggle is in the insert  statement
    I tried the following but it show an error
    Insert Into  Newtable
    ( St_ID, C1_code,c1_name, C1_Score ,C2_code  ,C2_name,C2_score,C3_code ,C3_name,C3_score)
    Select
    (Select St_ID from  StudentTable)
    (Select C_code,c_name,c_Score
    from  Coursetable,SudentTable
    where course.Stid =Studet.stid)
    (Select  C_code,c_name,c_Score
    from course ,student
    where course.Stid =Studet.stid  ),
    (Select C_code,c_name,c_Score
    from course ,student
    where  course.Stid =Studet.stid );
    I'm fully aware that the New table will break  the rules of normalization ,but I need it in this way for specifc purpose.
    I tried  also the PIVOT BY functionality but no luck with it .
    FYI , I'm not  expert in using SQL Syntax , I just know the basic.
    I will be great full for  any helpfull suggestions to try ,
    thank you very  much.

    First Table is Member table which Represent
    Students Information
    .The fields in this table are
    member_sk (PrimaryKey), full_or_part_time, gender, age_at_entry, age_band_at_entry, disability, ethnicity,
    widening_participation_level, nationality
    Second Table is Modules table which include
    the Courses' scores that Student took .
    The fields in this table are
    Module_result_k(Primary Key), member_sk(Foreign key to connect to Member table), member_stage_sk
    ,module_k(Foreign key to connect to Module table), module_confirmed_grade_src, credit_or_result
    Third Table is
    AllModuleInfo which is include
    general information for each course .The fields in this table are
    Module_k (Primary key), module_name ,module_code, Module_credit, Module stage.
    The New table
    that I will create has the following fields
    member_sk (PrimaryKey), full_or_part_time, gender, age_at_entry, age_band_at_entry, disability, ethnicity,
    widening_participation_level, nationality 
    " This will be retrieved from Member table"
    Also will include
    Module 1_name ,module1_code, Module1_credit, Module1_ stage, member1_stage_sk
    , module1_confirmed_grade_src, credit1_or_result
    Module 2_name ,module2_code, Module2_credit, Module2_ stage, member2_stage_sk
    , module2_confirmed_grade_src, credit2_or_result
    I will repeat this fields 14 times which is equal to Maximum courses number 
    that any of the students took.
    //// I hope now my questions become more clear

  • Unable to create view on COSP table for enpense related GL accounts.

    Hi,
    I want to extract only expense GL accounts related expense into BW. I tried to use standard data source: 0CO_OM_CCA_01 & 0CO_OM_CCA_02. but as these two data sources doesn't have profit center, trading partner and segment. so we are planning to use a view on table: COSP.
    When I am trying to create a view, its throwing error "the reference field is from some different table".
    Need your suggestion in creating the view.
    Regards,
    Ravi.

    Hi Ravi,
    Before deciding to create a generic DataSource, you should evaluate the options to enhance a Business Content DataSource. It is possible to extend the extract structure with additional fields and fill them in Enhancement RSAP0001 or BAdI RSU5_SAPI_BADI.
    If you would decide to go for a generic DataSource after all, then please share more details on the issue you are facing. I.e. detailed error message(s), screenshots, etc.
    Best regards,
    Sander

  • Adding a pivot table while creating report in BI publisher

    Hi all,
    I have been working on OBIEE and i need to create a multipage report. I have created a report in BI Dashboard using pivot table and i like to create the same pivot table (as pdf report) by using BI publisher.
    But i am unable to add pivot table in the rtf file that is used as template.
    When i am creating a template in rtf format, it has only three option either you can add table or form or Cross tab. I have tried to add the pivot table but i didn't find any way to add that.
    Pls suggest me to solve this.
    Thanks
    Ashok

    Please look at the hyperlinks description in the rtf template section of the report designer guide. It should get you started.

  • Question on how to create a pivot table

    Hi,
    I am trying to create a dynamic pivot table (the number of column and row layers change for each request) and I cannot use a data base structure to back it up.
    I thought of doing it through a managed bean but in order to do it I need to know how to create the PivotTableModel.
    The pivot table model requires a data source object and I do not know how to create it to support multiple row and column layers.
    Is there a default data source object that I can extend, or better yet is there a written example on how to create a pivot table model using a managed bean.
    Thanks,
    Or

    Hi,
    duplicate of ADF -11g : Question on how to create a pivot table

  • ADF -11g : Question on how to create a pivot table

    Hi,
    I am trying to create a dynamic pivot table (the number of column and row layers change for each request) and I cannot use a data base structure to back it up.
    I thought of doing it through a managed bean but in order to do it I need to know how to create the PivotTableModel.
    The pivot table model requires a data source object and I do not know how to create it to support multiple row and column layers.
    Is there a default data source object that I can extend, or better yet is there a written example on how to create a pivot table model using a managed bean.
    Thanks,
    Or
    Edited by: user638363 on Dec 18, 2008 7:02 AM

    Hi,
    beyond the documentation, the pivot table is described in
    http://technology.amis.nl/blog/2593/adf-faces-11g-reloading-the-matrix-using-the-pivot-table-component
    http://technology.amis.nl/blog/3786/creating-a-salary-heat-map-with-the-adf-11g-faces-pivottable-component
    http://technology.amis.nl/blog/3673/adf-11g-richfaces-a-closer-look-at-the-pivot-table-data-visualization-component
    I am not aware of any sample that directly meets your requirement
    Frank

  • Create view from multiple days tables

    Hi,
    I'm having existing oracle db with daily stat data, tables strangely named data_mon, data_tue, data_wed.. For my batch processing I plan to use view with multiple day data, let say for last 5 days.
    Not sure how better implement my sql statement, with those _mon suffixes to make it more or less dynamic.
    I also never create View from multiple tables, so probably I can do something that will add fresh daily data and delete 5 days old data?
    Will appreciate you comments on details and whole concept. I have prev sql server experience.
    Thanks
    T

    user12943718 wrote:
    Hi,
    I'm having existing oracle db with daily stat data, tables strangely named data_mon, data_tue, data_wed.. For my batch processing I plan to use view with multiple day data, let say for last 5 days.
    Not sure how better implement my sql statement, with those _mon suffixes to make it more or less dynamic.
    I also never create View from multiple tables, so probably I can do something that will add fresh daily data and delete 5 days old data?
    Will appreciate you comments on details and whole concept. I have prev sql server experience.
    Thanks
    TChange the data model so you don't have 1 table for a day.
    You just have a DATA table, and a column to denote the day of applicability.
    Then you don't need a view, don't need anything dynamic, don't need to smash your head against a wall for a simple query ... etc.

  • Create pivot table from multiple sheets

    How to Create single pivot table from multiple sheets

    Hello,
    Debra Dahlgleish has a tutorial video on her site: 
    http://blog.contextures.com/archives/2010/04/16/how-to-create-an-excel-pivot-table-from-multiple-sheets/
    This Office support article also covers the steps:
    http://office.microsoft.com/en-001/excel-help/consolidate-multiple-worksheets-into-one-pivottable-report-HA010226585.aspx
    Both the video and the article relate to Excel 2007 but the steps will be similar in current versions.
    cheers, teylyn

  • 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.

Maybe you are looking for

  • Differences in Pricing of Credit memo invoice and Credit memo.

    We have difference in prices when we create a return credit memo. We have scale price and for 500 product the scale price is 92 rs. the basic price is 112. We have created an order for 500 items where 92 rs has piced and in the invoce for 500 92 rs h

  • Subscriptions and payment information would not ca...

    I kept getting an error when trying to cancel my subscriptions and remove my payment information. I was finally able to today after several payment attempts (kept getting the error screen). Also, my card was charged again even though I did a one time

  • Can you please help with Fancybox CSS?

    Hello. Someone helped me a while back on creating fancybox boxes that generate pop out boxes with more content in them by clicking on them. Here is what they look like. I deleted a lot of the other content because it would just much everthing up. htt

  • Naming 'Cust enhancement' tab in Project Systems?

    Hi All: We have created Custom fields in project definition by following SPRO->Project Systems->Structures->Operative Structures->WBS->Enhancements->Create Custom Fields. Now once we have done with that, we got a new tab 'Cut. enhancement' under whic

  • How do I get a link to a photo stream in ios 7?

    In the old operating system, it was easy to get a link to a photo stream to share as a public web site.  I can't for the life of me figure this out in the new Operating System.  Help!