I'm working on Saiku reports in ReportServer. I have added a Mondrian Data Source. Now i would like to add two Rows in the report to show a Sum in the 3rd row, i did some R&D and found that we can use Cell formatter that can use Formula to use columns from the Schema XML. But i'm unable to get is exact source.
Here is the source i found from Mondrian Documentation:
<CalculatedMember name="name" dimension="dimension">
<Formula>
[Measures].[Unit Sales] * 2
</Formula>
<CellFormatter>
<Script language="JavaScript">
var s = value.toString();
while (s.length() < 20) {
s = "0" + s;
}
return s;
</Script>
</CellFormatter>
</Measure>
But this seems incorrect and this the block i want as its use Formula tag and using [Measures].[Unit Sales] * 2 that is looking helpful for me.
Can any one help me to correct this tag.
Here is the solution I found for the problem.
<CalculatedMember name="Profit" dimension="Measures" formula="[Measures].[Store Sales] - [Measures].[Store Cost]">
<CalculatedMemberProperty name="FORMAT_STRING" value="$#,##0.00"/>
</CalculatedMember>
Hope this would be helpful for anyone else.
Related
I have been working on a custom dll (that is called via a custom xll / Excel Addin) to construct MDX and return 2D data.
It's working nicely and I just went to work out how I add the ability to send in an exclusion list using EXCEPT.
I built up a query with filtering and this query works except it ignores the EXCEPT. Anyone with more MDX than me (I'm about 2 months in haha :)) know why?
Thanks
Leigh
WITH
Member [Measures].[Book_Label] AS [Book].[Book].CURRENTMEMBER.MEMBER_CAPTION
Member [Measures].[Isin_Label] AS [Isin].[Isin].CURRENTMEMBER.MEMBER_CAPTION
SELECT
NON EMPTY
{[Measures].[Book_Label],[Measures].[Isin_Label],[Measures].[Notional.SUM]}
ON COLUMNS,
NON EMPTY ORDER
(
EXCEPT(
FILTER(
([Book].CHILDREN,[Isin].CHILDREN),
([Book].[Book].CURRENTMEMBER.MEMBER_CAPTION = "ALGO1")
),
[Isin].[Isin].[DE0001104776]),
[Notional.SUM]
,
BASC)
ON ROWS
FROM[TraderCube]
WHERE ([Date].[Date].[2019-11-18])
That is nice progress in two months. A humble piece of advise, you should always specify your problem in simple words along with the code developed so far. That helps the person answering.
Form your code, my understanding is you want "ALGO1" books with all members of [ISin] except the member "DE0001104776". Based on this understanding use the code below
NON EMPTY
ORDER
(
([Book].[Book].[ALGO1],{[Isin].[Isin].children-[Isin].[Isin].[DE0001104776]}),
[Notional.SUM],
BASC
)
I returned to trying out combining my currently working 1..n FILTER builder in conjunction with an EXCEPT (requested by business). Unfortunately, despite the query passing syntax check and executing, as reported in original post the cube/server ignores it.
I just tried adding a <> to my FILTER and it worked! :)
Here's an example.
WITH
Member [Measures].[Book_Label] AS [Book].[Book].CURRENTMEMBER.MEMBER_CAPTION
Member [Measures].[Isin_Label] AS [Isin].[Isin].CURRENTMEMBER.MEMBER_CAPTION
SELECT
NON EMPTY {[Measures].[Book_Label],[Measures].[Isin_Label],[Measures].[Notional.SUM]}
ON COLUMNS,
NON EMPTY
ORDER(
FILTER(
([Book].CHILDREN,[Isin].CHILDREN),
(([Book].[Book].CURRENTMEMBER.MEMBER_CAPTION = \"ALGO1\") AND
([Isin].[Isin].CURRENTMEMBER.MEMBER_CAPTION <> \"DE0001102309\"))
),[Notional.SUM],
BASC)
ON ROWS
FROM[TraderCube]
WHERE([Date].[Date].[2019-11-21])
I am trying to extract ticket details from Service Now. Is there a way to extract the details without ODBC ? I have also tried the solution mentioned in [1]: https://community.servicenow.com/docs/DOC-3844, but I am receiving an error 9 -subscript out of range.
Is there a better way to extract details efficiently? I tried asking this in the service now forum but I thought I might get other opinions from here.
It's been a while since this question is asked. Hopefully following is still useful.
I am extracting change data (not incident) , but the process still should be same. You will need to gather incident table and column information. Then there are couple of ways to approach the problem.
1) If the data you are extracting has fixed parameters , such as fixed period or fixed column or group etc., then you can create a report within servicenow and then use REST/SOAP API to get the data in text/csv format. You can use different python modules to convert from csv to xls or xlsx depending on you need. I used openpyXL ,csv , xlsreader ,xlswriter etc.
See here for a example
ServiceNow - How to use SOAP to download reports
2) If the data has dynmaic parameters where you need to change columns, dates or filter etc, you can still use soap / REST API but form query within python scripts instead of having static report. This way you can change it based on your requirement on the fly.
Here is an example query for DB. you can use example for above. Just switch url with following.
table_name = 'u_change_table_name' #SN DB holding change/INCIDENT info
table_limit = 800
table_query = 'active=true&sysparm_display_value=true&planned_start_date=today'
date_query = 'chg_start_date>=javascript:gs.daysAgoStart(1)^active=true^chg_type=normal'
table_fields = 'chg_number,chg_start_date,chg_duration,chg_end_date' #Actual column names from DB and not from SN report.
url= (
'https://yourcompany.service-now.com/api/now/table/' +table_name +\
'?sysparm_query=' + date_query + '&sysparm_fields=' \
+ table_fields + '&sysparm_limit=' + str(table_limit)
)
I am following .filter() example
This is live example
The live example seems not working.
I want to show only rows with Office in London
Have I missed something? or What more needs to be done?
Thanks.
I have update you fiddle :
fiddle link
.
Filter method does not filter the rows.
You need to use $.fn.dataTableExt.afnFiltering in your case.
The #Reagan Gallant's example works with Datatables version >= 1.10.
For Datatables < 1.10 use following
var table = $('#example').dataTable();
table.fnFilter("London", 2, true);
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"))
I want to make a Report in Penthao Report Designer
My SQL query tells me the SUM of some variables and another variable is already the same SUM.
So for Example
DATE Name Expected SUM
Today A 20 20
Today B 10 5
Inside the Report Designer i select a Text field which is OK if Expected-SUM=0 else Error.
Inside my Report i know want to display if for "Today" all those Textfields are OK (than one row should display OK) or if at least one of them is Error than only Display one Row with Error for a given Date
I'm thankfull for every suggestion.
As here are no suggestions so far, maybe this is one solution: I would do this with an JavaScript-Step, but as a tranformation with a field and a filter-step:
Javascript:
var testing = "";
if(expected - sum == 0){
testing = "ok";
}
else {
testing = date;
}
And after that a filter-step, which sends rows to an "error"-output-report (with given date): filter is "testing NOT ok".
Sorry if thats not the solution for your problem, I have no experiences with Reports ... But maybe it's a hint and you asked for "every suggestion" :)
Hope it works!