MDX custom period parsing out - mdx

I´m trying to create a measure to divide the time dimension into periods, but the Parser just keeps...parsing. Here´s the attempted member:
WITH MEMBER [Measures].[Period] AS
CASE
WHEN [Registerdate].[Registerdate].Currentmember.MEMBERVALUE <
"2016-02-15T00:00:00" THEN ('Inreg Per 2016-01')
/.../
ELSE ('Period not mapped')
END
Any advice welcome. Thank you in advance.
/M

Related

Case Statement Assistance

I have a case statement currently built but need to add an extra layer and I'm not sure of the most efficient and accurate way of doing it. I have these drug codes that are for SYRINGE usage, and another set of codes for PEN usage. I have those layers built in, easy enough. I am trying to add a third layer to determine if the member used both a pen and a syringe, so the member would have a code from both categories during my specified time period. Any ideas? Thanks in advance for the help!
, CASE WHEN NDC.GPI IN (
'2710400300D220',
'2710400300D233',
'2710400300D236',
'2710400400D220',
'2799100225D220',
'2799100235D220') THEN 'PEN'
WHEN NDC.GPI IN (
'27104004002022',
'27104010002005',
'27104020001805',
'27104070001820',
'2730001000E530') THEN 'SYRINGE'
ELSE 'OTHER' END AS DOSAGE_FORM

Correct xml data type for Payroll hours

I'm trying to integrate the Payroll API (USA) but running into challenges posting a Timesheet.
I'm using a JSON to xml parser which is giving me an output like this:
<?xml version="1.0"?>
<Timesheet>
<EmployeeID>9e246df3-8775-43ee-bc7e-47f5f5896964</EmployeeID>
<EndDate>2017-10-16T00:00:00Z</EndDate>
<Hours>43.2000</Hours>
<StartDate>2017-10-10T00:00:00Z</StartDate>
<Status>Draft</Status>
</Timesheet>
I have no experience with xml APIs but that looks the same as the example code provided. However on the API end the hours I get returned are 0:
"Status":"DRAFT","Hours":0,
etc...
The Timesheet on the user console end also has 0 hours.
Is there something else I need to be considering here?
Thanks
Answer:
I had misinterpreted the API, the "Hours" for a period is the hours calculated by Xero, based on the quantity of pay items provided.
Hopefully this clarifies in case anyone else has same confusion.

Scribe Jobs: how to get the current date and compare it?

Honesty I'm very new in terms of Scribe Jobs, but I have been trying to develop a Job that get the current date and compare it against one field from the source (CRM input Date).
This is the code in the formula editor of the Pre-Operation Step Control:
IF(S146 =TODAY( ), GOTOSTEP ( ),FAILROW( ))
I'm trying to allow the migration only for records inserted today, the rest will just generate error.
Can somebody help me?
Try this:
if( DATEDIFF ("d", GETCURRENTUTCTIME, S146) < 1 )
Here's a great place to look for more information:
http://help.scribesoft.com/scribeonline/en/sol/formulas/datefunctions.htm

String to MDX code

I have the following scenario:
I have my MDX code in a cell in a dimension.
e.g. [MDXCode].[Code].[Code] contains the string:
"([GL Account].[GL Account Code L1].&[ABC],[Measures].[Amount]) + ([GL Account].[GL Account Code L1].&[XYZ],[Measures].[Amount])"
Now I want this cell evaluated as MDX code.
I tried with StrToMember and ToTuple but do not get it working.
e.g.
StrToTuple([MDXCode].[Code].[Code])
However if I limit my example to ([GL Account].[GL Account Code L1].&[ABC],[Measures].[Amount]) it works. If I add another tuple to sum both it does not..
Try this:
StrToValue([MDXCode].[Code].CurrentMember.Name)
Edit upon further info. If you can make MDX Formula a property of Ratio Name:
StrToValue([Finance Ratio].[Ratio Name].CurrentMember.Properties("MDX Formula"))

MDX Help and tutorial

Hello guys again here with my MDX headaches (why does my boss think programmer = solve anything computer related).
The measure of the Filter
Productos is compose this way [Casa].[Linea].[Producto] and I am trying to filter by Linea 72 and 74, outside this anyone know a good tutorial online or book for MDX?
Anyways here my MDX so far
SELECT 'Dic 1 2010' AS Fecha, A.*
from (SELECT
"[Measures].[Piezas Dia]",
"[Measures].[P Redondeadas]"
FROM openrowset('MSOLAP'
,'DATASOURCE=XXX
;Initial Catalog=XXX
; User Id=XXX;Password=XXX;',
'WITH SET [Lineas] AS ''
FILTER(DESCENDANTS([PRODUCTOS],[LINEA],SELF),
ANCESTOR([PRODUCTOS].CURRENTMEMBER,SELF) <> [74 VARIOS] AND
ANCESTOR([PRODUCTOS].CURRENTMEMBER,SELF) <> [72 VARIOS] )''
Member [Measures].[Piezas Dia] AS ''sum([Lineas],[Measures].[|P| Venta Dia Año Actual])''
Member [Measures].[P Redondeadas] AS ''sum([Lineas],[Measures].[Venta Piezas Redondeadas])''
SELECT {[Measures].[Piezas Dia], [Measures].[P Redondeadas]} on columns
FROM [Venta Gerencial]
WHERE ([Fecha Diario].[Fecha].&[2010].&[12].&[1])')) as A
Thanks for all help provided.
You can find an 'gentle' introduction to MDX here
You asked for a book referral. My boss just purchased SQL Server 2008 MDX Step by Step for me. I'm beginning to go through it and I like the way it is laid out. I've been programming in T-SQL for over ten years and MDX is just close enough to confuse me. This book is helping me think different about my code and coding practices. I haven't finished it, but I do think that it might be a good one for you to start with, as you can jump in anywhere in the book to learn what you need to know.
Should it really be a , instead of a ; here:
FROM openrowset('MSOLAP' ***,*** 'DATASOURCE=HDZNT10