Use of Pivot

Hi All,
I need to add an additional column to the below list here the [approved] column is a sum of list of columns from the second select stm in the code "SELECT @COL += N', ' + QUOTENAME([RN])" which gives values as col1+col2+col3....
so on
I need to add YES if the sum gives some results else I need to add NO(if sum of col1+..+Coln is 0) value to [Approved] column in the output.
I am ok if second select is written in a different way( remember that col1..Coln list is big) everything is working file I just need to add this [Approved] column to this list, which will hv the value as Yes/No based the sum of Col1+Col2....+Coln
'''' AS [Approved], -- here is the colulmn I want to ADD as YES or NO
DECLARE
@COL NVARCHAR(MAX) = N'',
@COL2 NVARCHAR(MAX) = N'',
@Sql NVARCHAR(MAX);
SELECT @COL += N', ' + QUOTENAME([RN])
FROM [dbo].[Defination]
WHERE [IsActive] = 1
AND [type]='XX'
ORDER BY [RNo];
--This gives me list of columns comma separated col1,col2,col3...
SELECT @COL2 += N'+' + QUOTENAME([RN])
FROM [dbo].[Defination]
WHERE [IsActive] = 1
AND [RuleType]='XX'
ORDER BY [RNo];
SELECT @COL2 = SUBSTRING(@Columns2,2,LEN(@Columns2))
-- this gives me the list of columns with sum like col1+col2+col3....
SET @Sql = N'
SELECT [EFid], [EFNm],[Estatus],[Approved]' + @COL + N'
FROM
SELECT
[EP].[EFid],
[EP].[EFNm],
[EP].[Estatus],
'''' AS [Approved], -- here is the colulmn I want to ADD as YES or NO based on the Summation result of Col1+Col2... from @col2
[RD2].[Rno],
1 AS [Item]
FROM EPF AS [EP]
LEFT JOIN [ETL].[RRRow] AS [RRR]
ON [RRR].[ExtractDateID] = [EP].[ExtractDateID]
AND [RRR].[SourceID] = [EP].[SourceID]
) [EP]
PIVOT (COUNT([Item]) FOR [Rno] IN (' + SUBSTRING(@Columns, 2, LEN(@Columns) - 1) + ')) AS pvt
ORDER BY [EFid]';
EXECUTE sp_executesql @Sql;
Sample output is as below
EFid]  [EFNm] [Estatus] [Approved] [col1] [col2]...
11      xx         valid        Yes            10     0
12      yy         valid        NO        
    0       0  --
As the sum of col1 and col2 is 0 hence approved col has NO value, i need drive this value
Neil

A screen shot isn't DDL...
DDL & test data looks like this...
CREATE TABLE dbo.SomeEntity (
EntityKeyCol INT NOT NULL PRIMARY KEY,
AttributeCol1 VARCHAR(10) NOT NULL,
AttributeCol2 VARCHAR(10) NOT NULL,
AttributeCol3 VARCHAR(10) NOT NULL
INSERT dbo.SomeEntity (EntityKeyCol,AttributeCol1,AttributeCol2,AttributeCol3) VALUES
(1,'Some','Stuff','to'),
(2,'Actually','test','sql'),
(3,'scripts','with','.')
CREATE NONCLUSTERED INDEX ix_SomeEntity_AttributeCol2 ON dbo.SomeEntity (
AttributeCol3)
INCLUDE (
EntityKeyCol,
AttributeCol1)
This way the people who are trying to help you know exactly what kind of data structures you're working with. They know what your keys, constraints and indexes are. And... (perhaps most importantly) they can actually spend their time working on a solution
instead of trying to reverse engineer your table schema or trying to concoct reliant test data.
Hint... The easiest way to do this... Right click the table name in the object explorer and choose Script Table AS > CREATE To > New Query Editor Window
That'll give you the full table DDL and all of the other pertinent pertinents. :)
Then it's just a matter adding the insert statement... I've found that dumping some data into excel and formatting it there is helpful. especially it the data needs to be obfuscated before you release it into the wild.
HTH,
Jason
Jason Long

Similar Messages

  • Error on clicking "Report Data Source" in library created using power pivot template

    Hi,
    On clicking on "Report Data Source"  in library created using power pivot template i am getting below exception. Can some one help me in understanding the root cause / fix it.
    Error being shown: Microsoft.ReportingServices.SharePoint.SharedService.Client.RecoverableCommunicationException: The content type text/html; charset=utf-8 of the response message does not match the content type of the binding (application/soap+msbin1).
    If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 1024 bytes of the response were: '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
     <html xmlns="http://www.w3.org/1999/xhtml">  <head>  <title>IIS 8.0 Detailed Error - 500.19 - Internal Server Error</title>  <style type="text/css">  <!--  body{margin:0;font-size:.7em;font-family:Verdana,Arial,Helvetica,sans-serif;}
     code{margin:0;color:#006600;font-size:1.1em;font-weight:bold;}  .config_source code{font-size:.8em;color:#000000;}  pre{margin:0;font-size:1.4em;word-wrap:break-word;}  ul,ol{margin:10px 0 10px 5px;}  ul.first,ol.first{margin-top:5px;}
     fieldset{padding:0 15px 10px 15px;word-break:break-all;}  .summary-container fieldset{padding-bottom:5px;margin-top:4px;}  legend.no-expand-all{padding:2px 15px 4px 10px;margin:0 0 0 -12px;}  legend{color:#333333;;margin:4px 0 8px -12px;_margin-top:0px;
     font-weight:bold;font-size:1em;}  a:link,a:visited{color:#007EFF;font-weight:bold;}  a:hover{text-decoration:none;}  h1{font-size:2.4em;margin:0;color:#FFF;}  h2{font-size:1.7em;margin:0'. ---> System.ServiceModel.ProtocolException:
    The content type text/html; charset=utf-8 of the response message does not match the content type of the binding (application/soap+msbin1). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 1024
    bytes of the response were: '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">  <html xmlns="http://www.w3.org/1999/xhtml">  <head>  <title>IIS
    8.0 Detailed Error - 500.19 - Internal Server Error</title>  <style type="text/css">  <!--  body{margin:0;font-size:.7em;font-family:Verdana,Arial,Helvetica,sans-serif;}  code{margin:0;color:#006600;font-size:1.1em;font-weight:bold;}
     .config_source code{font-size:.8em;color:#000000;}  pre{margin:0;font-size:1.4em;word-wrap:break-word;}  ul,ol{margin:10px 0 10px 5px;}  ul.first,ol.first{margin-top:5px;}  fieldset{padding:0 15px 10px 15px;word-break:break-all;}
     .summary-container fieldset{padding-bottom:5px;margin-top:4px;}  legend.no-expand-all{padding:2px 15px 4px 10px;margin:0 0 0 -12px;}  legend{color:#333333;;margin:4px 0 8px -12px;_margin-top:0px;  font-weight:bold;font-size:1em;}  a:link,a:visited{color:#007EFF;font-weight:bold;}
     a:hover{text-decoration:none;}  h1{font-size:2.4em;margin:0;color:#FFF;}  h2{font-size:1.7em;margin:0'. ---> System.Net.WebException: The remote server returned an error: (500) Internal Server Error.    
     at System.Net.HttpWebRequest.GetResponse()    
     at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)     -
     -- End of inner exception stack trace ---    Server stack trace:     
     at System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory`1 factory, WebException responseException, ChannelBinding channelBinding)    
     at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)    
     at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)    
     at System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.Request(Message message, TimeSpan timeout)    
     at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)    
     at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)    
     at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)    Exception rethrown
     at [0]:     
     at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)    
     at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)    
     at Microsoft.ReportingServices.ServiceContract.IReportServiceManagement.get_IsWebServiceEnabled()    
     at Microsoft.ReportingServices.SharePoint.SharedService.Client.ReportingWebServiceApplicationProxy.<>c__DisplayClass8`1.<ExecuteOnApplication>b__6(IReportServiceManagement proxy, Int32 dummy)    
     at Microsoft.ReportingServices.SharePoint.SharedService.Client.ReportingWebServiceApplicationProxy.ExecuteOnChannel[T](String siteUrl, String xmlNamespace, Action`2 method, IChannel channel, Int32 maxFaultSize)    
     at Microsoft.ReportingServices.SharePoint.SharedService.Client.ReportingWebServiceApplicationProxy.HandleExecuteOnChannel[T](String siteUrl, String xmlNamespace, Action`2 method, SPServiceLoadBalancerContext loadBalancerContext)     -
     -- End of inner exception stack trace ---    
     at Microsoft.ReportingServices.SharePoint.SharedService.Client.ReportingWebServiceApplicationProxy.HandleExecuteOnChannel[T](String siteUrl, String xmlNamespace, Action`2 method, SPServiceLoadBalancerContext loadBalancerContext)    
     at Microsoft.ReportingServices.SharePoint.SharedService.Client.ReportingWebServiceApplicationProxy.ExecuteOnApplication[T](String operationName, String siteUrl, String xmlNamespace, Action`2 method)    
     at Microsoft.ReportingServices.SharePoint.SharedService.Client.ReportingWebServiceApplicationProxy.Invoke[T](SPServiceContext serviceContext, String operationName, String siteUrl, String xmlNamespace, Guid serviceInstanceId, Action`2 method)    
     at Microsoft.ReportingServices.SharePoint.SharedService.Client.ReportingWebServiceClient.Execute[TResult](String methodName, Func`2 action)    
     at Microsoft.ReportingServices.SharePoint.UI.BaseRSLayoutPage.ValidateReportServerConnection(SrvProxy rsProxy)
    Followed steps from below link :
    http://www.mssqltips.com/sqlservertip/3004/getting-started-with-power-view-reports-with-sharepoint-excel-and-sql-server/
    Thanks,
    Venugopal

    Hi Venugopal,
    Please refer to the blogs below and see if it works for your case:
    http://sharepointerthilosh.blogspot.com/2013/10/sharepoint-2013-reports-unexpected.html
    http://badalratra.wordpress.com/2014/03/13/error-the-content-type-texthtml/
    To create a Power View report, start Power View from a
    data model file in SharePoint Server 2010 or 2013. Models, or connections to models, can be in a SharePoint Server document library or in a
    Power Pivot Gallery, a special purpose SharePoint Server document library that provides rich preview and document management for published Microsoft Excel workbooks that contain data models.
    Please refer to the links below to get report in Power View in SharePoint server:
    http://office.microsoft.com/en-in/excel-help/power-view-in-sharepoint-server-create-save-and-print-reports-HA102834736.aspx
    http://office.microsoft.com/en-in/excel-help/create-a-connection-to-a-data-model-for-power-view-HA102835737.aspx
    Regards,
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected] .
    Rebecca Tu
    TechNet Community Support

  • Use of pivot operator

    Hi,
    I am facing problem in mapping using pivot operator . The error comes out as the code cannot be generated as it contains more than one type of sequence.
    If we have to use a aggregator operator in between pivot and target how we can do that, what expression should be written
    Please help me out with this
    Thanks

    ORA-04063: package body "WORK_DEMO.MAP_DEMO_PIVOT" has errors
    ORA-06508: PL/SQL: could not find program unit being called: "WORK_DEMO.MAP_DEMO_PIVOT"
    ORA-06512: at line 1          
    This is error I am getting while using pivot operator.
    actually there is a file in crosstab format .. and I have attached an external operator with it to use in mappping.. now i want to use the pivot
    transformation
    but I get this error..

  • How to sum only the positive numbers in a Pivot table when using Power Pivot

    Hi, I have this schema:
    …and this Pivot:
    How do I get this result from PowerPivot.
    If I only use normal Excel Pivot I could use Calculated Field and get the wanted result in a snatch.
    But I guess the problem with using PowerPivot in this scenario is a context or/and a aggregation problem?
    Here is the formula I try to use (I have also tried the FILTER function but couldn’t get it right):
    TRUE DEMAND (Forecast- Stock>0) =
    CALCULATE([TOTAL DIFF (FORECAST-STOCK)],
    [TOTAL DIFF (FORECAST-STOCK)]>0)
    Here is my ExcelFile:
    https://onedrive.live.com/redir?resid=B7906DD091ACC085!357&authkey=!AJN_r_1NCP4thrE&ithint=file%2cxlsx
    Any suggestions?
    Best Regards
    Tommy

    Hi Tommy,
    sorry, a few words are not enough.
    This post does explains it in detail:
    http://sqlblog.com/blogs/marco_russo/archive/2010/01/03/how-calculate-works-in-dax.aspx
    Imke

  • 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 XML PIVOT clause in SQL to generate crosstab report BI Pub. Possible?

    I am trying to use the XML version of the Pivot Clause in an SQL query to generate the SQL needed for a cross tabular or Pivot report in BI Publisher. How can I use the output (e.g. below) in BI publisher as the SQL query? It is ignoring the XML column when I view the output in BI. IS this possible and has anyone tried this?
    for example
    SQL> SELECT *
    2 FROM (
    3 SELECT deptno, job, sal
    4 FROM emp
    5 )
    6 PIVOT XML
    7 (SUM(sal) FOR deptno IN (ANY));
    JOB DEPTNO_XML
    ANALYST <PivotSet><item><column name = "DEPTNO">20</column><column name = "SUM(SAL)
    ">6600</column></item></PivotSet>
    CLERK <PivotSet><item><column name = "DEPTNO">10</column><column name = "SUM(SAL)
    ">1430</column></item><item><column name = "DEPTNO">20</column><column name
    = "SUM(SAL)">2090</column></item><item><column name = "DEPTNO">30</column>
    <column name = "SUM(SAL)">1045</column></item></PivotSet>
    MANAGER <PivotSet><item><column name = "DEPTNO">10</column><column name = "SUM(SAL)
    ">2695</column></item><item><column name = "DEPTNO">20</column><column name
    = "SUM(SAL)">3272.5</column></item><item><column name = "DEPTNO">30</colum
    n><column name = "SUM(SAL)">3135</column></item></PivotSet>
    PRESIDENT <PivotSet><item><column name = "DEPTNO">10</column><column name = "SUM(SAL)
    ">5500</column></item></PivotSet>
    SALESMAN <PivotSet><item><column name = "DEPTNO">30</column><column name = "SUM(SAL)
    ">6160</column></item></PivotSet>
    thanks
    Paul P

    Sorry Sunder, you're going to have to work a little harder to get points! I know how the PIVOT clause and all its options work so I don't need documentation on just the SQL. Its how it works in BI that I'm interested in.
    I want to use the XML option in the PIVOT clause as I don't want to hard code the crosstab columns. (see my code in the original posting)
    I want to know if BI Publisher is able to read the output of the script when creating a report based on an SQL query and generate something that actually looks a crosstab rather than a column of XML. I want my report in BI to look something like the output below. (Sorry about output. I can't get fixed width font working on this forum).
    PRODUCT INTERNET_Q1 INTERNET_Q4 PARTNERS_Q2
    Bounce 347 632 954
    Smash Up Boxing 129 280 560
    Comic Book Heroes 47 155 275
    thanks
    Paul P

  • How to Create Power View Report using power pivot file in SharePoint 2013

    H,
    I have power pivot and Power View excel files. Now i want to create the Power View report in SharePoint 2013.
    What steps should i use?
    Can anyone help me on it.
    I need detailed step by step procedure.
    Thanks & Regards
    Poomani Sankaran

    Hi Aditya,
    Thanks for your reply.
    I am using Enterprise edition of SharePoint 2013 only. SQL Server 2012 SP1.
    I have configured Reporing Services also successfully. I got "Reporting" folder in "15" hive location "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\WebServices"
    SSRS Service application also i have created success in CA Manage Service Application.
    I have done "Reporting Services Add-in for SharePoint" also which is "rsSharePoint.msi".
    What should i do apart from this? Can you tell me. Its frustrating like anything. 
    I have added the "PowerPivot" excel in "PowerPivot Gallery" and clicked the icon "Create Power View Report"
    Thanks in Advance.
    Poomani Sankaran

  • Use of pivot-unpivot

    Hello,
    I have table T1 which has three columns col1, col2 col3 with values sachin, ramesh, tendulkar resp. I want output same as shown in the screenshot. I want to achieve this using pivot/unpivot operators. Please help.

    Hi Naomi,
    The query you suggested will work of the scenarios where the number of columns are not fixed? I have just given an example but In practicle there can be many more columns to my table like col1,col2,col3.....coln. Please let me know the dynamic query.
    Thanks!
    Sachin
    Naomi's Solution is perfect. If your table does not have fixed columns then there is a design problem. And BTW, In this case how can you have variable columns.
    I mean, there is FirstName, MiddelName and LastName. What is left? All the attributes of a name are considered in these three attributes. Apart from these you have Title, Sex and others but those are not part of a Name.
    Chaos isn’t a pit. Chaos is a ladder. Many who try to climb it fail and never get to try again. The fall breaks them. And some are given a chance to climb, but they refuse. They cling to the realm, or the gods, or love. Illusions. Only the ladder is real.
    The climb is all there is.

  • Issues with use of PIVOT function

    I have a single table that gives me a Value ID for each record. There are 1-3 of them for each Dim ID. The Name values of these can be found in a 2nd table, by the Value ID from the first table. I feel like this can be handled with the pivot function, but
    I'm having trouble figuring out how to set it up properly.
    Samples are below. Top left is table 1. Top right is table 2. Bottom is how I need the data to be captured in a query.

    DECLARE @dimValue TABLE (dimID INT, valueID INT)
    INSERT INTO @DimValue (dimID, valueID)
    VALUES
    (6,1),(6,10),(6,14),(8,3)
    DECLARE @dimNames TABLE (valueID int, name varchar(50), type varchar(10))
    INSERT INTO @DimNames (valueID, name, type)
    VALUES
    (1,'George','First'),(10,'Micheal','Middle'),(14,'Johnson','Last'),(3,'Stan','First')
    -- without pivot
    SELECT v.dimID, MAX(f.name) AS first, MAX(m.name) AS middle, MAX(l.name) AS last
    FROM @dimValue v
    LEFT OUTER JOIN @dimNames f
    ON v.valueID = f.valueID
    AND f.type = 'first'
    LEFT OUTER JOIN @dimNames m
    ON v.valueID = m.valueID
    AND m.type = 'middle'
    LEFT OUTER JOIN @dimNames l
    ON v.valueID = l.valueID
    AND l.type = 'last'
    GROUP BY v.dimID
    --pivot
    SELECT DimID, MAX(first) AS first, MAX(middle) AS middle, MAX(last) AS last
    FROM @dimNames n
    PIVOT (MAX(Name) FOR type IN (FIRST, middle, last)) pvt
    INNER JOIN @dimValue v
    ON pvt.valueID = v.valueID
    GROUP BY dimID
    This shows you how to do it with and without a pivot.
    Please don't post data as images. You force us to manually type it.
    Refer to the top of the code to see one way to give us demo data and objects.

  • How to pivot using pivot clause of sqlserver 2005 for three values

    Dear all
                Is it possible to formulate the query using pivote clause of sqlserver 2005.
    ( Table name is) BridgeHawra
    ReportDate,                 , Pole, DiameterCost,Flag,OuterDiaCost
    01 jan 2014,               ,1     ,   4.5      ,yes,6
    01 jan 2014,               ,2     ,   4.5        ,no,6
    01 jan 2014,               ,3    ,  5.5         ,no,6
    02 jan 2014,               ,4     ,  5.5        ,no,5.9
    02 jan 2014,               ,5     ,  5.5        ,no,6
    1)Pole Col will have unique value.
    o2)One pole will have one DiameterCost, but n number of DiameterCost can be there.
    I have to show a report which should show , count of poles and cost(DiameterCost* pole count of the day of each DiameterCost) for each date and DiameterCost.
    as following
    DateOfReport            ,  PoleCountofDiameterCost4.5, DiameterCost4.5, PoleCountOfDiameterCost5.5,DiameterCost5.5
    01 jan 2014              , 2                                      
          ,(2*4.5)                        ,1                                   
    ,(1*5.5)
    02 jan 2014              , 0/null                                      ,0/null
                              ,2                                
       ,(2*5.5)
    yours sincerely

    Yes it is possible though you need to use dynamic pivot technique. Dynamic pivot allow you to select/display column names dynamically.
    Below example does not use dynamic pivot,
    --create table #temp(ReportDate datetime,Pole int, DiameterCost decimal(5,2),Flag varchar(3),OuterDiaCost decimal(5,2))
    --insert into #temp values('01 jan 2014',1,4.5,'yes',6)
    --insert into #temp values('01 jan 2014',2,4.5,'no',6)
    --insert into #temp values('01 jan 2014',3,5.5,'no',6)
    --insert into #temp values('02 jan 2014',4,5.5,'no',5.9)
    --insert into #temp values('02 jan 2014',5,5.5,'no',6)
    ;with cte as (
    select ReportDate,
    DiameterCost * PoleCount as DiameterCost,
    PoleCount ,
    'PoleCountofDiameterCost'+cast(DiameterCost as varchar) column1,
    'DiameterCost'+cast(DiameterCost as varchar) column2
    from (
    select ReportDate,DiameterCost,Count(Pole) as PoleCount from #temp
    group by ReportDate,DiameterCost
    ) x
    ),cte1 as (
    select * from cte
    pivot( max(PoleCount) for column1 in ([PoleCountofDiameterCost4.50],[PoleCountofDiameterCost5.50])
    ) pvt
    pivot( max(DiameterCost) for column2 in ([DiameterCost4.50],[DiameterCost5.50])
    ) pvt1
    select ReportDate,
    Max([PoleCountofDiameterCost4.50]) [PoleCountofDiameterCost4.50],
    Max([DiameterCost4.50]) [DiameterCost4.50],
    Max([PoleCountofDiameterCost5.50]) [PoleCountofDiameterCost5.50],
    Max([DiameterCost5.50]) [DiameterCost5.50] from cte1
    group by ReportDate
    Regards, RSingh

  • Problem with SSAS cube reporting action when using pivot filter with cubevalue function

    Hi everyone,
    I have a quite specific problem when I combine cube actions (Reporting Action SSRS) with Excel's cubevalue() function.
    The problem is when I use a pivot filter as a parameter for the cubevalue() function. The action item does not show up in the context menue.
    The cube action works fine when I do it from a "normal" pivot or if I use the cubevalue() function without the reference to a pivot filter (all the parameters in the function are "hard-coded").
    I use SSAS 2012 and Excel 2010.
    Thanks for yor help.
    Gerhard

    Hi everyone,
    I actually figured out a way to solve this problem. I had to use a detour to solve this bug in Excel (at least I think it's a bug).
    What I needed to do: I had to make Excel belive that the filter is actuall hard-coded and does not come from a pivot filter. This was only possible by adding a new calculated measure to the cube that gives back the MEMBER_Unique_Name to the current member
    passed. This "value" can then be used to go back to the cube and select the cubemember function. Here is a small example.
    This is the cube member:
    CREATE MEMBER CURRENTCUBE.[Measures].[RegCompBranNameKey] AS
    [Company Branch].[Reg - Comp - Bran Name].CurrentMember.Properties("MEMBER_UNIQUE_NAME", TYPED),
    VISIBLE = 0 ;
    And this is then done in a hidden Excel cell:
    =CUBEMEMBER("Metrics";
     IF(RIGHT(CUBEVALUE("Metrics";<PivotFilter>;"[Measures].[RegCompBranNameKey]");5)="[ALL]";"[ALL]";
      RIGHT(CUBEVALUE("Metrics";<PivotFilter>;"[Measures].[RegCompBranNameKey]");LEN(CUBEVALUE("GlobalMetrics";<PivotFilter>;"[Measures].[RegCompBranNameKey]"))-57)
    I had to use the UniqueName property because I have a combined filter. That's also the reason for this truncation and also useing the last part of it. If you just have a straight key you more easily use it.

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

  • One question in measures table heading of a pivot table view when using 11g

    Hi experts,
    I have been working on OBIEE 10g for 2 years, and lately I started developing on OBIEE 11g. It is great to discover so many new features which make reporting so much easier and look better, meanwhile, I got confused by some detail changes they have made. I was able to overcome most of the difficulties I have met with, but now there is *1* I can not figure out. Any idea or suggestion is appreciated.
    In OBIEE 10g, when we develop a report using a pivot table, we put column A and B in Rows aera and column C Measures aera, the result would look like this:
    / / A / / B / / C / /
    //VA1 //VB1// VC1//
    //VA1// VB1 //VC1//
    But now I am using 11g, when I put these columns in the same aeres as I did in 10g, the result is surprising like this:
    / / BLANK / / C / /
    / / A / / B / / blank //
    //VA1 //VB1/|/ VC1//
    //VA1/|/VB1 // VC1//
    It looks weird that it should put Rows labels and Measure labels in different lines and create blank labels, and barely makes any sense. I am OK with the blank above the Row labels, but not with the blank below the measure label. A blank label that separates a label and its value is not what I want.
    Can anyone help me to make the pivot table look the same as it does in 10g? Or at least remove the blank label below the Measure label?
    Thanks in advance.

    Hi,
    I am facing the same issue, have you solved it?

  • Question using pivot

    I am very new  at using the pivot command in Oracle. I have a query and I am using the  pivot xml example because I am pivoting an unknown domain of values.  I am trying to use this query in Application Express the xml formatting is put all into one column. APEX  can not format the XML. Below is my query. Is there another way to pivot against unknown domain values. We are on 11.2.3 version of database.
    Thanks,
    Pam
    select * from (select country,item, prod_y.nutrients, form_rev,label_rev,batch_number,daycode,weight from prod_mstr,
    (select nutrients from prod_mstr where trim(label_rev)='6/12' and trim(country) = 'US' AND trim(item)='1025' and master ='Y') prod_y
    where TRIM(label_rev)='6/12' and trim(country) = 'US' AND trim(item)='1025' and master ='N'
    AND prod_y.nutrients(+) = prod_mstr.nutrients )
    PIVOT XML (sum(weight) for nutrients IN (select Nutrients nut from prod_mstr where trim(item) = :P_ITEM and trim(country) = :P_COU and master = 'Y'));

    Perhaps these threads might help:
    https://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:2648932900346131308
    https://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:766825833740

  • Satellite U200-122: How to use Pivot function on external Monitor?

    I have a Satellite U200-122, would like to use the external monitor in pivbot function.
    But I do not find where I can have the display rotate, so that it will be displayed in portrait format on the external monitor and accept resolution 1024x1280.
    Any ideas?
    Graphic driver: Intel Chipset 945GM express
    Thanks
    Isabel

    Thax for the tipp, but:
    That is exactly my problem: the intel graphics acceklerator DOES NOT offer any rotate functionality! I wonder why because I have read in many forums that it should have, I know it can be seen on the right part of the intel graphics accelerator window, but nothing is there.
    So i wonder, if in the U200 there is possibly a different graphic driver or management sofwtare, which just does not support this? Could it be that a graphic driver does not offer pivot???
    Shortcuts do not work either.
    Btw: when i put the laptop on a kensington workstation, then the kensington graphic manager -display -link - is used, and then with many workarounds i do get the monitor to show pivot in necessary reolution. but i want a to use a pivot monitor also at home without dockingstation...

Maybe you are looking for

  • Disk utility can't repair the Macintosh HD, asking toback up all files as possible? and how to  reformat the disk?

    disk utility can't repair the Macintosh HD, asking toback up all files as possible? and how to  reformat the disk?

  • Quicktime 7.2 upgrade

    I downloaded an upgrade for quicktime 7.2 yesterday. Now quicktime wont open. Get an unexpected quit when I open it. Downloaded Perian and still no joy? Can't play anything and my sound seems to have gone as well. Would appreciate any help.

  • Help me diagnose my connection

    Hi guys, I've noticed a 20Mbps drop in my downstream sync and I was wondering what might be causing it, I know most people will say that 60Mbps is enough but I just would like some thoughts as to why I'm experiencing the drop, ps my connection was so

  • Quick Cluster no longer appears in drop down lists

    I haven't changed any settings, one day my cluster just disappears off all the lists it used to appear in (selecting which cluster to use in Compressor, Compressor Droplets and Shake) Now all that shows is "My Computer". The QuickCluster wasn't anyth

  • Search for subject in Mail is case sensitive

    I'm hoping this is the right place to ask questions about Apple Mail as the organisation of this forum is mind baffling. Am I right in thinking that a search on the subject in Apple Mail is case sensitive. If so, how do I change this behaviour ?