Parameter for ORDER BY in DAX query not respected
I have an SSRS table fed by a parameterized DAX query (utilizing the methods in
thesearticles). I have all of my parameters working just fine except for those feeding my closing ORDER BY statement (I am offloading the sorting
to the Tabular for several reasons, including a large tested performance gain over sorting in SSRS). I have defined the ORDER BY as follows:
ORDER BY @Order1, @Order2, @Order3, @Order4
I cannot get even the first parameter to work. I can pass arbitrary strings with no impact on the report returned, though if I hard code the ORDER BY in the query, the ordering is respected, so I know this is a problem with the parameter.
Running a Profiler trace on the server when I fire the SSRS report returns the following as the parameter value for @Order1:
<Parameter>
<Name>Order1</Name>
<Value xsi:type="xsd:string">Dimuser[UserID-Name]</Value>
This is exactly what I want to replace @Order1, and when I hard code that exact string into my query I get the behavior I want.
I have played with \ escaping the brackets to no avail.
Any insight is greatly appreciated.
I have discovered a workable solution to my own problem.
The parameter is passed and interpreted as a quoted string, rather than as a field name.
I altered my query to follow this general format:
ORDER BY
SWITCH( TRUE()
, @Order1 = "User", DimUser[UserID-Name]
, SWITCH( TRUE()
, @Order2 = "User", DimUser[UserID-Name]
In this way I am comparing two quoted strings for equality and providing an unquoted field identifier that Tabular recognizes and can order by.
Similar Messages
-
M8 140 Acct assgt 01 for order item 45041838 00003 does not exist
Hi experts,
when i am trying to create invoice from BAPI_INCOMINGINVOICE_CREATE ii am getting the following error meesage for multi account assignment for non service based invoice ,service items.
error message: M8 140 Acct assgt 01 for order item 45041838 00003 does not exist
Please advice
Thanks & Regards,
NarasimhaHi,
Please check the SAP note number : 810917.
Regards, -
Cannot find GR Slip output type in Outbound Delivery for Order type KA
Hi Experts,
We need to ,setup output type for GR Slip. for a delivery created for Order Type KA
I am not able to find the Output Type in VL02N- Output (at item level).
I have alreday created conition record in VV21 against the sales Org for output type WABS
Please let me know if I am missing some thing
pls help
Regards,
ShettyHi
Does the output type exist in the output procedure ? If yes, is there a requirement assigned to the output type and is this fulfilled ?
Kind Regards
Torben -
Lock the production order creating without material for order type zp01
Hi all,
Good morning.My client wants to lock the production order creating without material for order type zp01.He does not want to create production order without material.Its very urgent.Please guide me the settings if any.
Thanks and Regards
SukumarHi Sukumar,
You can do by applying user exit.
Use PPCO0007 - Exit when saving production order.
Function module - EXIT_SAPLCOZV_001.
Include Program - ZXCO1U06
Write your Code:
*& Include ZXCO1U06
Regards,
Sankaran -
Query In SP runs 10x slower than straight query - NOT Parameter Sniffing Issue
Hi Everyone,
I have a real mystery on my hands that appears to be a parameter sniffing issue with my SP but I think is not. I have tried every parameter sniffing workaround trick in the book ( local variables, option recompile, with recompile, optimize for variables,UNKNOWN,
table hints, query hints, MAXDOP, etc.) I have dropped indexes/recreated indexes, updated statistics, etc. I have restored a copy of the DB to 2 different servers ( one with identical HW specs as the box having the issue, one totally different ) and the SP
runs fine on those 2, no workarounds needed. Execution plans are identical on all boxes. When I run a profiler on the 2 different boxes however, I see that on the server having issues, the Reads are around 8087859 while the other server with identical HW,
the reads are 10608. Not quite sure how to interpret those results or where to look for answers. When the sql server service is restarted on the server having issues and the sp is run, it runs fine for a time ( not sure how long ) and then goes back to its
snail pace speed. Here is the profile trace:
Here is the stored procedure. The only modifications I made were the local variables to eliminate the obvious parameter sniffing issues and I added the WITH NOLOCK hints:
/****** Object: StoredProcedure [dbo].[EC_EMP_APPR_SIGNATURE_SEL_TEST] Script Date: 12/03/2014 08:06:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object: StoredProcedure [dbo].[EC_EMP_APPR_SIGNATURE_SEL_TEST] Script Date: 12/02/2014 22:24:45 ******/
ALTER PROCEDURE [dbo].[EC_EMP_APPR_SIGNATURE_SEL_TEST]
@EMPLOYEE_ID varchar(9) ,
@OVERRIDE_JOB_CODE varchar(8),
@OVERRIDE_LOCATION_CODE varchar(8),
@OVERRIDE_EST_CODE varchar(8),
@OVERRIDE_EMP_GROUP_CODE varchar(8)
AS
set NOCOUNT ON
declare
@EMPLOYEE_ID_LOCAL varchar(9),
@OVERRIDE_JOB_CODE_LOCAL varchar(8),
@OVERRIDE_LOCATION_CODE_LOCAL varchar(8),
@OVERRIDE_EST_CODE_LOCAL varchar(8),
@OVERRIDE_EMP_GROUP_CODE_LOCAL varchar(8)
set @EMPLOYEE_ID_LOCAL = @EMPLOYEE_ID
set @OVERRIDE_JOB_CODE_LOCAL = @OVERRIDE_JOB_CODE
set @OVERRIDE_LOCATION_CODE_LOCAL = @OVERRIDE_LOCATION_CODE
set @OVERRIDE_EST_CODE_LOCAL = @OVERRIDE_EST_CODE
set @OVERRIDE_EMP_GROUP_CODE_LOCAL = @OVERRIDE_EMP_GROUP_CODE
select 3 as SIGNATURE_ID
from EC_EMPLOYEE_POSITIONS p
where p.EMPLOYEE_ID = @EMPLOYEE_ID_LOCAL
and DATEADD(dd, 0, DATEDIFF(dd, 0, GETDATE())) between p.POSITION_START_DATE and ISNULL(p.POSITION_END_DATE, convert(datetime, '47121231', 112))
and (dbo.lpad(isnull(p.job_code,''), 8, ' ') + dbo.lpad(isnull(p.location_code,''), 8, ' ') + dbo.lpad(isnull(p.ESTABLISHMENT_CODE,'<N/A>'), 8, ' ') + dbo.lpad(isnull(p.EMP_GROUP_CODE,''), 8, ' '))
in
(select (dbo.lpad(isnull(ep.REPORTING_JOB_CODE,''), 8, ' ') + dbo.lpad(isnull(ep.REPORTING_LOCATION_CODE,''), 8, ' ') + dbo.lpad(isnull(ep.REPORTING_ESTABLISHMENT_CODE,'<N/A>'), 8, ' ') + dbo.lpad(isnull(ep.REPORTING_EMP_GROUP_CODE,''),
8, ' '))
from EC_POSITIONS ep
where DATEADD(dd, 0, DATEDIFF(dd, 0, GETDATE())) between ep.POSITION_EFFECT_DATE
and ISNULL(ep.POSITION_TERM_DATE, convert(datetime, '47121231', 112))
and (dbo.lpad(isnull(ep.job_code,''), 8, ' ') + dbo.lpad(isnull(ep.location_code,''), 8, ' ') + dbo.lpad(isnull(ep.ESTABLISHMENT_CODE,'<N/A>'), 8, ' ') + dbo.lpad(isnull(ep.EMP_GROUP_CODE,''), 8, ' '))
= (dbo.lpad(isnull(@OVERRIDE_JOB_CODE_LOCAL,''), 8, ' ') + dbo.lpad(isnull(@OVERRIDE_LOCATION_CODE_LOCAL,''), 8, ' ') + dbo.lpad(isnull(@OVERRIDE_EST_CODE_LOCAL,'<N/A>'), 8, ' ') + dbo.lpad(isnull(@OVERRIDE_EMP_GROUP_CODE_LOCAL,''),
8, ' ')))
union
select 4 as SIGNATURE_ID
from EC_EMPLOYEE_POSITIONS p
where p.EMPLOYEE_ID = @EMPLOYEE_ID_LOCAL
and DATEADD(dd, 0, DATEDIFF(dd, 0, GETDATE())) between p.POSITION_START_DATE and ISNULL(p.POSITION_END_DATE, convert(datetime, '47121231', 112))
and (dbo.lpad(isnull(p.job_code,''), 8, ' ') + dbo.lpad(isnull(p.location_code,''), 8, ' ') + dbo.lpad(isnull(p.ESTABLISHMENT_CODE,'<N/A>'), 8, ' ') + dbo.lpad(isnull(p.EMP_GROUP_CODE,''), 8, ' '))
in
(select (dbo.lpad(isnull(ep.REPORTING_JOB_CODE,''), 8, ' ') + dbo.lpad(isnull(ep.REPORTING_LOCATION_CODE,''), 8, ' ') + dbo.lpad(isnull(ep.REPORTING_ESTABLISHMENT_CODE,'<N/A>'), 8, ' ') + dbo.lpad(isnull(ep.REPORTING_EMP_GROUP_CODE,''),
8, ' '))
from EC_POSITIONS ep with (NOLOCK)
where DATEADD(dd, 0, DATEDIFF(dd, 0, GETDATE())) between ep.POSITION_EFFECT_DATE
and ISNULL(ep.POSITION_TERM_DATE, convert(datetime, '47121231', 112))
and (dbo.lpad(isnull(ep.job_code,''), 8, ' ') + dbo.lpad(isnull(ep.location_code,''), 8, ' ') + dbo.lpad(isnull(ep.ESTABLISHMENT_CODE,'<N/A>'), 8, ' ') + dbo.lpad(isnull(ep.EMP_GROUP_CODE,''), 8, ' '))
in
(select (dbo.lpad(isnull(ep.REPORTING_JOB_CODE,''), 8, ' ') + dbo.lpad(isnull(ep.REPORTING_LOCATION_CODE,''), 8, ' ') + dbo.lpad(isnull(ep.REPORTING_ESTABLISHMENT_CODE,'<N/A>'), 8, ' ') + dbo.lpad(isnull(ep.REPORTING_EMP_GROUP_CODE,''),
8, ' '))
from EC_POSITIONS ep with (NOLOCK)
where DATEADD(dd, 0, DATEDIFF(dd, 0, GETDATE())) between ep.POSITION_EFFECT_DATE
and ISNULL(ep.POSITION_TERM_DATE, convert(datetime, '47121231', 112))
and (dbo.lpad(isnull(ep.job_code,''), 8, ' ') + dbo.lpad(isnull(ep.location_code,''), 8, ' ') + dbo.lpad(isnull(ep.ESTABLISHMENT_CODE,'<N/A>'), 8, ' ') + dbo.lpad(isnull(ep.EMP_GROUP_CODE,''), 8, ' '))
= (dbo.lpad(isnull(@OVERRIDE_JOB_CODE_LOCAL,''), 8, ' ') + dbo.lpad(isnull(@OVERRIDE_LOCATION_CODE_LOCAL,''), 8, ' ') + dbo.lpad(isnull(@OVERRIDE_EST_CODE_LOCAL,'<N/A>'), 8, ' ') + dbo.lpad(isnull(@OVERRIDE_EMP_GROUP_CODE_lOCAL,''),
8, ' '))))
order by SIGNATURE_ID
Any suggestions would be greatly appreciated by anyone. I have no more tricks left in my toolbox and am starting to think its either the hardware or the database engine itself that is at fault.
Maxfast server:
SQL Server parse and compile time:
CPU time = 0 ms, elapsed time = 0 ms.
SQL Server Execution Times:
CPU time = 0 ms, elapsed time = 0 ms.
SQL Server Execution Times:
CPU time = 0 ms, elapsed time = 0 ms.
SQL Server Execution Times:
CPU time = 0 ms, elapsed time = 0 ms.
SQL Server Execution Times:
CPU time = 0 ms, elapsed time = 0 ms.
SQL Server Execution Times:
CPU time = 0 ms, elapsed time = 0 ms.
SQL Server Execution Times:
CPU time = 0 ms, elapsed time = 0 ms.
Table 'EC_POSITIONS'. Scan count 3, logical reads 10450, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
Table 'EC_EMPLOYEE_POSITIONS'. Scan count 2, logical reads 6, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
SQL Server Execution Times:
CPU time = 3343 ms, elapsed time = 3460 ms.
SQL Server Execution Times:
CPU time = 3343 ms, elapsed time = 3460 ms.
Slow server:
SQL Server parse and compile time:
CPU time = 0 ms, elapsed time = 0 ms.
SQL Server Execution Times:
CPU time = 0 ms, elapsed time = 0 ms.
SQL Server Execution Times:
CPU time = 0 ms, elapsed time = 0 ms.
SQL Server Execution Times:
CPU time = 0 ms, elapsed time = 0 ms.
SQL Server Execution Times:
CPU time = 0 ms, elapsed time = 0 ms.
SQL Server Execution Times:
CPU time = 0 ms, elapsed time = 0 ms.
SQL Server Execution Times:
CPU time = 0 ms, elapsed time = 0 ms.
Table 'EC_POSITIONS'. Scan count 3, logical reads 10450, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
Table 'EC_EMPLOYEE_POSITIONS'. Scan count 2, logical reads 6, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
SQL Server Execution Times:
CPU time = 37875 ms, elapsed time = 38295 ms.
SQL Server Execution Times:
CPU time = 37875 ms, elapsed time = 38295 ms.
Big diff in server execution times.... -
Oracle date parameter query not working?
http://stackoverflow.com/questions/14539489/oracle-date-parameter-query-not-working
Trying to run the below query, but always fails even though the parameter values matches. I'm thinking there is a precision issue for :xRowVersion_prev parameter. I want too keep as much precision as possible.
Delete
from CONCURRENCYTESTITEMS
where ITEMID = :xItemId
and ROWVERSION = :xRowVersion_prev
The Oracle Rowversion is a TimestampLTZ and so is the oracle parameter type.
The same code & query works in Sql Server, but not Oracle.
Public Function CreateConnection() As IDbConnection
Dim sl As New SettingsLoader
Dim cs As String = sl.ObtainConnectionString
Dim cn As OracleConnection = New OracleConnection(cs)
cn.Open()
Return cn
End Function
Public Function CreateCommand(connection As IDbConnection) As IDbCommand
Dim cmd As OracleCommand = DirectCast(connection.CreateCommand, OracleCommand)
cmd.BindByName = True
Return cmd
End Function
<TestMethod()>
<TestCategory("Oracle")> _
Public Sub Test_POC_Delete()
Dim connection As IDbConnection = CreateConnection()
Dim rowver As DateTime = DateTime.Now
Dim id As Decimal
Using cmd As IDbCommand = CreateCommand(connection)
cmd.CommandText = "insert into CONCURRENCYTESTITEMS values(SEQ_CONCURRENCYTESTITEMS.nextval,'bla bla bla',:xRowVersion) returning ITEMID into :myOutputParameter"
Dim p As OracleParameter = New OracleParameter
p.Direction = ParameterDirection.ReturnValue
p.DbType = DbType.Decimal
p.ParameterName = "myOutputParameter"
cmd.Parameters.Add(p)
Dim v As OracleParameter = New OracleParameter
v.Direction = ParameterDirection.Input
v.OracleDbType = OracleDbType.TimeStampLTZ
v.ParameterName = "xRowVersion"
v.Value = rowver
cmd.Parameters.Add(v)
cmd.ExecuteNonQuery()
id = CType(p.Value, Decimal)
End Using
Using cmd As IDbCommand = m_DBTypesFactory.CreateCommand(connection)
cmd.CommandText = " Delete from CONCURRENCYTESTITEMS where ITEMID = :xItemId and ROWVERSION = :xRowVersion_prev"
Dim p As OracleParameter = New OracleParameter
p.Direction = ParameterDirection.Input
p.DbType = DbType.Decimal
p.ParameterName = "xItemId"
p.Value = id
cmd.Parameters.Add(p)
Dim v As OracleParameter = New OracleParameter
v.Direction = ParameterDirection.Input
v.OracleDbType = OracleDbType.TimeStampLTZ
v.ParameterName = "xRowVersion_prev"
v.Value = rowver
v.Precision = 6 '????
cmd.Parameters.Add(v)
Dim cnt As Integer = cmd.ExecuteNonQuery()
If cnt = 0 Then Assert.Fail() 'should delete
End Using
connection.Close()
End Sub
Schema:
-- ****** Object: Table SYSTEM.CONCURRENCYTESTITEMS Script Date: 1/26/2013 11:56:50 AM ******
CREATE TABLE "CONCURRENCYTESTITEMS" (
"ITEMID" NUMBER(19,0) NOT NULL,
"NOTES" NCHAR(200) NOT NULL,
"ROWVERSION" TIMESTAMP(6) WITH LOCAL TIME ZONE NOT NULL)
STORAGE (
NEXT 1048576 )
Sequence:
-- ****** Object: Sequence SYSTEM.SEQ_CONCURRENCYTESTITEMS Script Date: 1/26/2013 12:12:48 PM ******
CREATE SEQUENCE "SEQ_CONCURRENCYTESTITEMS"
START WITH 1
CACHE 20
MAXVALUE 9999999999999999999999999999still not comming...
i have one table each entry is having only one fromdata and one todate only
i am running below in sql it is showing two rows. ok.
select t1.U_frmdate,t1.U_todate ,ISNULL(t2.firstName,'')+ ',' +ISNULL(t2.middleName ,'')+','+ISNULL(t2.lastName,'') AS NAME, T2.empID AS EMPID, T2.U_emp AS Empticket,t2.U_PFAcc,t0.U_pf
from [@PR_PRCSAL1] t0 inner join [@PR_OPRCSAL] t1
on t0.DocEntry = t1.DocEntry
inner join ohem t2
on t2.empID = t0.U_empid where t0.U_empid between '830' and '850' and t1.U_frmdate ='20160801' and t1.u_todate='20160830'
in commond promt
select t1.U_frmdate,t1.U_todate ,ISNULL(t2.firstName,'')+ ',' +ISNULL(t2.middleName ,'')+','+ISNULL(t2.lastName,'') AS NAME, T2.empID AS EMPID, T2.U_emp AS Empticket,t2.U_PFAcc,t0.U_pf
from [@PR_PRCSAL1] t0 inner join [@PR_OPRCSAL] t1
on t0.DocEntry = t1.DocEntry
inner join ohem t2
on t2.empID = t0.U_empid where t0.U_empid between {?FromEmid} and {?ToEmid} and t1.U_frmdate ={?FDate} and t1.u_todate={?TDate}
still not showing any results.. -
Af:query not fetching records when VC Modified for advance search
Gurus,
I have a view criteria and using it i have a af:query component in my page. When i run the page i see the fields in the search box correctly. However i see another LOV in the search which has options like "Equals","Between", "Does not contain" etc. Though this option is good for 1 search criteria, it is not of any use for another. How can i remove it from the search criteria that i dont want
thnks
Jdev 11.1.1.5.you would need to add the following to the view criteria item in the view criteria definition for the VO - in order NOT to show any of the operators.
<CompOper
Name="DepartmentName"
ToDo="-2"
Oper="">You would need to do - by open the VO.xml and add this xml snippet - which would ensure that the operators are NOT shown in the query panel.
Sample:
For Departments VO, say there is a view criteria that defined on department id and department name and you do NOT want to show the operators.
After defining the VC, open the VO file - add the above.
<ViewCriteria
Name="DepartmentsVOByDeptIdorDeptName"
ViewObjectName="com.samples.model.DepartmentsVO"
Conjunction="AND">
<Properties>
<CustomProperties>
<Property
Name="displayOperators"
Value="Always"/>
<Property
Name="autoExecute"
Value="false"/>
<Property
Name="allowConjunctionOverride"
Value="true"/>
<Property
Name="showInList"
Value="true"/>
<Property
Name="mode"
Value="Basic"/>
</CustomProperties>
</Properties>
<ViewCriteriaRow
Name="vcrow0"
UpperColumns="1">
<ViewCriteriaItem
Name="DepartmentsVOCriteria_vcrow0_DepartmentId"
ViewAttribute="DepartmentId"
Operator="="
Conjunction="AND"
Required="Optional"/>
<ViewCriteriaItem
Name="DepartmentsVOCriteria_vcrow0_DepartmentName"
ViewAttribute="DepartmentName"
Operator="STARTSWITH"
Conjunction="AND"
Required="Optional">
*<CompOper*
Name="DepartmentName"
ToDo="-2"
Oper="">
*</CompOper>*
</ViewCriteriaItem>
</ViewCriteriaRow>
</ViewCriteria>
Thanks,
Navaneeth -
Tabular DAX Query for MINX, MAXX and AVGX
Hi,
I need to create three measure to get value of min, max and avg.
For example, I have 3 columns in my table. I need to take minimum value of Column3 based on column2. If column2 value is 0, then we have to consider entire table data else only we have to consider
Column1 Column2 Column3
AAA 1 150
BBB 1 50
CCC 0 25
DDD 1 40
EEEE 0 70
I need to take minimum,maximun and avg value of Column3 based on column2. If column2 value is 0, then we have to consider entire table data. IF column2 value is 1, then only we have to consider the row of column2=1.
I expect the result as like below. Can you please help to find the DAX query for the measure.
Column1 Column2 Column3 MinValue
AAA 1 150 40
BBB 1 50 40
CCC 0 25 25
DDD 1 40 40
EEE 0 70 25
EEE 0 70Hi,
I have 3 columns in my table. I need to take minimum value of Column3 based on column2. If column2 value is 0, then i have to consider entire table data else only i have take minimum(column3) by considering rows of column2=1.
Column1 Column2 Column3
AAA 1 150
BBB 1 50
CCC 0 25
DDD 1 40
EEEE 0 70
Try1:
Min:=IF(Column2>0,MINX(FILTER(table,[column2]>0),[column3]),Min(Column3))
Try2:
Min:=MINX(IF(Column2>0,FILTER(table,[column2]>0),table),[column3]))
Try3:
Created Measure called Min1.
Min1:=MINX(FILTER(Table,[Column2]>0),[Column3])
And then i made this min1 measure to be hidden.
Created another measure called Min2.
Min2:=IF(ISBLANK([Min1]),MIN([column3]),[Min1])
Both DAX query is not working. Can anyone help to have the correct DAX query to create Min measure based on the conditions. -
XSQL query output as parameter for next xsql query
Hi,
Is it possible to use the output of one xsql query as input parameter for the next xsql query in the same file. I am trying to retreive an id from the query and use it in the next one. I cannot combine all the queries into one, since I intend to make the first query a database function that returns the id I am looking for. I am looking for something like this
<xsql:query>
select '1000' as myid
from dual
</xsql:query>
<xsql:query>
select add1,ro1
from table1
where id = {@myid}
</xsql>
I need the id returned by the first query to be used in the second one. Eventually my first query will be a stored procedure that validates the users rights and on sucess return the following tag <myid> 1000 <myid>.
Please let me know , how I can achieve my goal of validating a user's priveleges and then executing the second query.
Thanks
PadmajaHi ,
Thanks for the response.This works if the first query is a select .
If the first query was a call to a db procedure that returned the <myid>100<myid> would this still work?
<xsql:set-page-param name="myid">
<xsql:include-owa>
xyz;
</xsql:include-owa>
</xsql:set-page-param>
<xsql:include-param name="myid"/>
<xsql:query>
select name from mytable where id={@myid}
</xsql:query>
I have to use include-owa as the db procedure xyz does some cookie validations and then returns an id based on that. The procedure xyz returns an xml tag of form <myid>100<myid>
This does not work as the value of myid is not available to the second query.
Thanks
Padmaja -
Hi..Experts
I need to design a query say Q1, Its taking prod order through a replacement path Query Q2,which is
restricted by Cal month variable.
As i check Query Q1 for allow external uses, Its giving error " Query not releases for OLE DB"
But when I restrict Q2 by fixed month then there is no error....but this is not fulfill my requirement.
I need Q2 should be restricted by Cal Month variable...
What I have done is.....first I restrict Q2 by fixed month. then Q1 query executing perfectly.Once Q1
is executing again i restrict Q2 by cal mont variable. Then also Q1 is running fine, even though it is checked allow
external Access.
I also execute Q1 query in RSRT without using cache . It is working fine. But as I open Q1 on another day is not working, WHY?
I am not getting....Please help me...
your comments will be appreciated..
Edited by: Abhishek@maventic on Jul 8, 2011 3:10 PMCheck whether this helps you
[OLE DB for OLAP|http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/6a8eb390-0201-0010-8fa3-b70f6f9a17c1?quicklink=index&overridelayout=true]
thanks
G. Lakshmipathi -
DAX - Querying: How to reinforce a filter in order to calculate a year to date
Dear community,
I am pulling my hair off due to an issue I am having with the creation of a DAX query (supposed to feed an SSRS report).
The topic is P&L related, I need to compute the revenue based on specific cost elements, that same query must return additional columns that represent YTD, Forecast,... etc ( a couple of typical aggregations).
First of all here is the query I currently simplified to explain my issue:
EVALUATE
CALCULATETABLE(
SUMMARIZE(
GENERATE(
VALUES(AccountingPeriod[RealAccountingPeriod]),
FactFInancialTransaction
AccountingPeriod[Code],
CostElement[Code],
CostElement[Group],
"Revenue", [Revenue],
"GroupRevenue",
CALCULATE(
[Revenue],
all(CostElement[Code])
FILTER(
VALUES(CostElement[Code]),
CostElement[Code] = "RSFOR" ||
CostElement[Code] = "RSTHI" ||
CostElement[Code] = "RSOTH"
FILTER(
VALUES(CostElement[Group]),
CostElement[Group] = "RGOVE"
FILTER(
ALL(AccountingPeriod),
AccountingPeriod[Code] = 201402
FILTER(
VALUES(OperationalUnit[OperationalUnitNumber]),
VALUES(OperationalUnit[OperationalUnitNumber]) = "052"
The Revenue is simply a SUM of an amount column in FactFinancialTransactions.
What I am unable to do is compute GroupRevenue where I simply would like to sum the revenues for the elements. Does anybody have an idea on the calculate statement that will help me achieve this?
I tried doing something like:
CALCULATE(
[Revenue], all(FactFinancialTransactions),
all(CostElement[Code]), Values(CostElement[Group]), Values(AccountingPeriod[code]) Values(OperationalUnit[OperationalUnitNumber]) )
This does not work at all, it looks like the VALUES(OperationalUnit[OperationalUnitNumber]) context is not reinforced, the value I get in return is actually the one summing ALL operational units.
PS: I have to keep the filter on OperationalUnit as is because it will actually be a pathcontains statement that can pass multiple values
Thanks so much for any help
Mils.I am not entirely sure about your requirements and your data model.
However, I would start using ADDCOLUMNS instead of SUMMARIZE to add columns to the group you need.
EVALUATE
CALCULATETABLE (
ADDCOLUMNS (
SUMMARIZE (
GENERATE (
VALUES ( AccountingPeriod[RealAccountingPeriod] ),
FactFInancialTransaction
AccountingPeriod[Code],
CostElement[Code],
CostElement[Group]
"Revenue", [Revenue],
"GroupRevenue", CALCULATE ( [Revenue], ALL ( CostElement[Code] ) )
FILTER (
VALUES ( CostElement[Code] ),
CostElement[Code] = "RSFOR"
|| CostElement[Code] = "RSTHI"
|| CostElement[Code] = "RSOTH"
FILTER (
VALUES ( CostElement[Group] ),
CostElement[Group] = "RGOVE"
FILTER (
ALL ( AccountingPeriod ),
AccountingPeriod[Code] = 201402
FILTER (
VALUES ( OperationalUnit[OperationalUnitNumber] ),
VALUES ( OperationalUnit[OperationalUnitNumber] ) = "052"
Marco Russo (Blog,
Twitter,
LinkedIn) - sqlbi.com:
Articles, Videos,
Tools, Consultancy,
Training
Format with DAX Formatter and design with
DAX Patterns. Learn
Power Pivot and SSAS Tabular. -
Query for Order recomendation from MRP.
Good evening,
Recommendations are saved for the Production and Purchase Order after MRP is done. New Production and/or Purchase Orders are created in Planned stages. We need a query for the Alert Management to the users for the new Orders created.
Please can anyone guide and help me.
thank you.Hi,
Welcome you post on the forum.
Try this for production order:
SELECT T0.DocNum, T0.ItemCode FROM OWOR T0
WHERE T0.OriginType = 'R' AND DateDiff(dd,T0.DocDate,GetDate())=0
Thanks,
Gordon
Good Morning Sir,
Thanks for your message, guidance and support for the query.
The query for the alert for Production is working fine, we just changed the DocDate to PostDate as the Production Order, Posting date is as PostDate.
We tried to change the OWOR to OPOR and the Origin type to T0.Comments='Origin :MRP' and tried for Purchase Order, but the alert is not visible. Would it be ok, that we create an UDF and try the same?.
thanks and warm regards. -
LOCID is not defiend for Order data type ORDR
Dear All,
I am trying to load data in to Order forecast details in Dynamic
replenishment of SNC in the WEB UI, after entering the Product and
Customer location, when I clicked on GO system is giving the below
error.
Time series error in class /SCF/CL_ICHDM_DEMANDMN_DATAAXS
method /SCF/IF_ICHDMAXS_2_CNTL~SELECT
Access error for time series type DFC01, key figure CORDEROR, ODM
message: Parameter LOCID is not define for order data type ORDR
Could you please help me out what to do in this case.
I have re activated the following components mentioned, still system is
giving the above problem.
Activate Order Component
Activate Order Data Type
Activate Order Data Area
and
Activate Time Series Data Type
Activate Time Series Data Area
Thanks and Regards,
T.MuthyalappaHi,
Make sure you have proper authorization.(sometime system does not display the error but user don't have authorization to create/update/modify table entries to be on safer side assign SAP_ALL profile to your ID if it is allowed as per your company security process).
I think issue is with InfoObject 9ALOCID is not activated properly.
You need activate InfoObject 9ALOCID as mention i below step2 but it is better you follow below steps.
1) Then force generate ODM.
2)Go to transaction code:/N/SCA/TSDM09 enter time series DFC01 and select Radio button Activate Planning object Structure.
Regards,
Nikhil. -
Hi All,
Greetings.
I have two queries namely,
1.Query for cancelled requisitions and
2.Query for Internal Requisitions without Internal Sales Orders.
I was on a task to combine those two queries..
Can we do that? if so, please help me do that..
Thanks in Advance,
Bhaskar.Hi All,
Greetings.
I have two queries namely,
1.Query for cancelled requisitions and
2.Query for Internal Requisitions without Internal Sales Orders.
I was on a task to combine those two queries..
Can we do that? if so, please help me do that..
Thanks in Advance,
Bhaskar. -
Invoice is not allowed for order 00065
Hi experts,
This error is relating to the Accounts payables(SAP). The error occurred and the invoice has fallen out from ERP (SAP) while posting the invoice. The error is "no invoice is allowed for order 00065".
some Inputs: if you go to ME23N screen line item details invoice tab you can find the check boxes like Incoming Invoice, cost centre and Order. Usually for a particular PO incoming invoice and cost centre check boxes will be checked but in this case Order check box is checked and the invoice has fallen out from ERP.
Could any body please let me know how to resolve this issue in SAP. I'm not FI/CO consultant but SAP BW if I know i can guide team.
Thanks in advance,
amarnathDear,
What is message number? Did you assign the usersttus in BS02?
For allocation activity costs, we need to define activity type in KL01 by specifying the unit of measurement of the particular activity type (like machine - Hours etc.). While creating activity type, we will assign a secondary cost element (with category 43) in the activity type through which the activity cost will flow.
After that we will plan for cost center in KP06 (cost elementwise). Then we will plan machine hours in KP26 where we will link the activity type to a particular cost center.
When we do price calculation in KSPI, system checks the planned costs for cost center (in KP06) and also checks the machine hours planned (in KP26) and gives the cost for the particular activity type.
Please check the above in the system
Regards,
R.Brahmankar
Maybe you are looking for
-
Can't Install Mac OS 10.4 in Apple PowerBook G4 Titanium
Hello! I have an Apple PowerBook G4 Titanium (400Mhz). My system crash when I tried to enter and hang up in the Apple logo. I used Diskwarrior and TechTool Pro to identify the problem, but there;s no error. I inserted the 10.4 installer and format th
-
Can't Open MS Office 2008 in 2nd User Account
Bought a new iMac, transferred everything from my old Mac including Office 2008 and now want to setup a separate user account for my wife. However, Office in the new user account starts in setup mode, checks for updates but then doesn't launch. I've
-
tell the reasons why java is very secure compare than other languages
-
How to install HCM 9.2 demo database for non oracle platform
i am new to peoplesoft. We are planning for an upgrade to hcm 9.2 and peopletools 8.53. We are currently on 9.0 and peopletools 8.51 and SQL platform. i understand we have to creat a demo the old fashion way for SQL. I cannot find any required at up
-
Possible to sell on copy of FCS2 without any problems for new user?
Hi guys I have a copy of Final Cut Studio 2 and I never use it so I want to sell it on. I did register it when I bought it so is this going to affect the resale? I don't want to sell it if the new owner cant treat it as theirs. Thanks