I have this MDX query:
WITH
MEMBER [CLIENT].[WITHOUT CLIENT X] AS
'[CLIENT].[All CLIENTs] - [CLIENT].[CLIENT X]'
SELECT
[Measures].[Sales] ON COLUMNS
,{[STORE].[All STOREs].Children} ON ROWS
FROM [Sales]
WHERE
CrossJoin
(
{[YEAR].[2015]}
,{[CLIENT].[WITHOUT CLIENT X]}
);
This query return corect result (All stores sales without [CLIENT].[CLIENT X]).
Now, I want to use this calculated member ([CLIENT].[WITHOUT CLIENT X]) in Saiku, OpenI, BTable or Pivot4J as a normal dimension or something like this.
For this i added in schema.xml:
<CalculatedMember name="WITHOUT CLIENT X"
formula="([CLIENT].[All CLIENTs] - [CLIENT].[CLIENT X])" hierarchy="CLIENT" parent="CLIENT" visible="true"></CalculatedMember>
If i run:
Select [Measures].[Sales] on COLUMNS,
{[STORE].[All STOREs].Children} ON ROWS
from [Sales]
WHERE CrossJoin({[YEAR].[2015]}, {[CLIENT].[WITHOUT CLIENT X]})
the result returned is corect, but i can't see this dimension [CLIENT].[WITHOUT CLIENT X].
In Saiku, OpenI or Pivot4J i can't find this dimension.
BTable get this dimension as MEASURES because of CDA (/api/olap/getCubeStructure) and result is this:
{
"type": "measure",
"name": "WITHOUT CLIENT X",
"caption": "WITHOUT CLIENT X]",
"qualifiedName": "[CLIENT].[CLIENT X]",
"memberType": "FORMULA"
}
but is useless because I can't use in filter.
Do you have same answers?
Posible questions:
Why u use member and not named set?
Because dimension CLIENT it's huge (more than 50000) query with member run in 1 sec and with set in more than 5 minutes
why don't use EXCEPT?
Same as 1.
why not use just mdx query?
Because final report is for non-tehnic and they want to change this filter.
UPDATE INFO
I renamed [CLIENT].[WITHOUT_this_CLIENT] with [CLIENT].[WITHOUT CLIENT X] and [CLIENT].[My Special Client] with *[CLIENT].[CLIENT X]*to avoid some confusion.
I want to filter a level in this way: add all members (CLIENT) except one (CLIENT X).
The result returned is corect when i use mdx query, because GUI OLAP clients cant read my xml schema.
I don't know where is my error.
Thank you,
Geo
SOLVED
For what I want (filtering one element from a big list) the answer is this:
I created another dimension, which is used just for filter.
<Dimension type="StandardDimension" visible="true" highCardinality="false" name="CLIENT X">
<Hierarchy visible="true" hasAll="true">
<Table name="SALES" schema="SALES" />
<Level name="CLIENT X" visible="true" column="CLIENT" type="String" uniqueMembers="false" levelType="Regular" hideMemberIf="Never">
<KeyExpression>
<SQL dialect="oracle">
<![CDATA[CASE WHEN CLIENT = 'CLIENT X' THEN 'CLIENT X' ELSE 'WITHOUT CLIENT X' END]]>
</SQL>
</KeyExpression>
</Level>
</Hierarchy>
</Dimension>
You're not defining your member correctly. ie. The parent member must be the fully qualified name of the parent of the newly created member, not the level's name. Read this carefully and you'll figure it out.
Related
I have three entities
Case - new_welfarecases
Goal - new_casegoal
Activity - new_welfarecaseactivity
Now each Case will have multiple Goals and each Goal will have multiple Activities(N:1)
In the goal entity, new_caseid is the lookup field for Case
The case has a business process flow defined and the flow has stages like initiation, moved to next level etc
The stage of the goal is captured in field called new_startstageofthecase
To get list of goals for a case in particular stage I use the below fetchxml
var fetchXml = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>"
+"<entity name='new_casegoal'>"
+"<attribute name='new_startstageofthecase' />"
+"<filter type='and'>"
+"<condition attribute='new_startstageofthecase' operator='"+ goalFilterOption +"' value='" + currentStageId +"' />"
+"</filter>"
+"</entity>"
+ "</fetch>";
Subgrid.control.SetParameter("fetchXml", fetchXml); //set the fetch xml to the sub grid
Now I want to retrieve the list of activities for a case in particular stage, how can I fetch them?
Activities entity does not have the stage field, but it has to be fetched from the goal it is associated to.
The lookup for goal in activity entity is new_childwelfarecasegoalid
Everytime I need to build those queries I go to the Advanced Find in CRM.
1) Start with an advanced find to look for Activities.
2) Then add a join to Goal entity (Related Entities -> Goal),
3) Then, add a join from Goal to the Record entity.
You can add as many filters on each of the entities. In your case a filter for the specific Stage and Record.
Then export the resulting FetchXml from the View.
As I understand you, you want to:
Fetch Activities that have a Goal that has an Record.
The Record should be a specific Record.
The Record should have a specific stage in the BPF.
A query along those lines would look like:
<fetch version='1.0' mapping='logical' distinct='false'>
<entity name="new_Activity">
<all-attributes />
<link-entity name="new_Goal" from="new_goalid" to="new_goal">
<link-entity name="new_Record" from="new_recordid" to="new_record">
<filter type="and">
<condition attribute="new_recordid" operator="eq" value="{<record-guid-here>}" />
</filter>
<link-entity name="processstage" from="processstageid" to="stageid">
<filter type="and">
<condition attribute="stagename" operator="eq" value="<stage-name-here>" />
</filter>
</link-entity>
</link-entity>
</link-entity>
</entity>
</fetch>
Please note that although this question is an entirely different question, it relates directly to this question.
The following is the script that returns the dataset for my SSRS chart:
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false" aggregate="true">
<entity name="account">
<attribute name="bio_employeesworldwide" alias="TotalWorldWideEmployees" aggregate="sum" />
<filter>
<condition attribute="customertypecode" operator="eq" value="2" />
</filter>
<link-entity name="contact" from="parentcustomerid" to="accountid" alias="contact">
<attribute name="bio_webuseraccountstatus" alias="count_bio_webuseraccountstatus" aggregate="countcolumn" />
<attribute name="bio_webuseraccountstatus" alias="bio_webuseraccountstatusgroupby" groupby="true" />
</link-entity>
</entity>
</fetch>
The values for bio_webuseraccountstatus can be Active, Inactive, Disabled, Pending, etc..
In FetchXML is there a way to do a case statement where you "InActive" for every value that is not equal to "Active" ?
As you can see I've been trying to solve this issue within the reporting layer, but am experiencing lots of "string format" issues.
Can this be done with the dataset layer (fetchxml) instead?
According to this Microsoft forum post:
There's no equivalent function in FetchXml. Instead, you will need to return each field value, and process the CASE logic in the calling code. If this FetchXml is to be used in a report, then you may be able to implement the CASE logic in a calculated field on the report.
You can always parse the output of the fetchxml on return.
So rather than pushing to the screen, report, or db, the original record field of isreceivetravelalerts, you check the status (zero or one) and rewrite it, and add the new variable to your output. Clunky, but useful.
if ($record->isreceivetravelalerts == 1)
{
$travel_alerts = "Active";
}
$travel_alerts = "Inactive";
I am looking for a method to check if a cube is accessable i.e. it is processed and not broken.
Example: I got a working cube and i full process a shared dimension so that the cube gets broken.
Is there any mdx or xmla method of finding out what cubes are accessable / processed?
There is an XMLA command DISCOVER_XML_METADATA that can return the state of the database (processes/unprocessed) among other properties. I don't have the best handle on XMLA, so I don't know how to get just the part you need, but this query will return results in the form of XML, and you can parse it from there.
<Discover xmlns="urn:schemas-microsoft-com:xml-analysis">
<RequestType>DISCOVER_XML_METADATA</RequestType>
<Restrictions>
<RestrictionList>
<DatabaseID>AdventureWorks2012MD</DatabaseID>
</RestrictionList>
</Restrictions>
<Properties>
<PropertyList>
</PropertyList>
</Properties>
</Discover>
This requests gets the properties from the objects related to the SSAS database called AdventureWorks2012M. In the results you will see the following:
<Database>
<Name>AdventureWorks2012MD</Name>
<ID>AdventureWorks2012MD</ID>
<CreatedTimestamp>2013-08-01T01:41:10.926667</CreatedTimestamp>
<LastSchemaUpdate>2013-08-01T01:45:05.91</LastSchemaUpdate>
<Description />
<LastProcessed>2013-08-01T01:46:39.713333</LastProcessed>
<State>Processed</State>
<LastUpdate>2014-01-07T19:41:45.146667</LastUpdate>
<AggregationPrefix />
<Language>1033</Language>
<Collation>Latin1_General_CI_AS</Collation>
<Visible>true</Visible>
...
You care about <State>Processed</State>for that database. You can also get the state for each of the dimensions and measure groups as well by adding MeasureGroupID or DimensionID to the restrictions list.
I'm trying to set up custom aggregated tables in our mondrian data warehouse.
I defined the custom aggregated table like this:
<Table>
<AggName name="..." ...>
<AggFactCount ...></AggFactCount>
<AggMeasure name="[Measures].[Example]" column="..."> </AggMeasureName>
</AggName>
</Table>
As long as [Measures].[Example] points to a <Measure name="Example" column="..." .../> item it works fine.
When it points to a <CalculatedMember name="Example" formula="..." ... /> then I get the following error message:
"Failed to find measure 'Example' for Cube 'ExampleCube'"
As far as I checked it online, this thing should be working for recent versions. We're using mondrian 2.4.2 which supports only Measures in AggregatedTables.
Is there any workaround, sg. like defining a cache-table?
Maybe is it enough to provide a configuration item?
Thanks,
Tamas
My database connection is MySQL through JDBC, standard innodb.
From this, I created a very simple data source with two dimensions and one measure.
The two dimensions are:
location (string)
ddate (date/time, at least in Mysql)
The measure is the same "location" element, set to aggregate on count
I am trying to get a fairly simple count of items by location, by day of the week (either mon-sun or 1-7 is fine)
I have tried dozens of variations on the following, including "with member...as..." for extracting the day of week, all met with failure.
SELECT
NON EMPTY Hierarchize({ datepart("d",cdate([diDate.hDate].[mDate]) }) ON COLUMNS,
NON EMPTY {Hierarchize({[diLocation.hLocation].[mLocation].Members})} ON ROWS
FROM [k_olap]
Any help would be greatly appreciated. I've been banging my head against this for hours & hours, and it seems like it should be simple & straightforward for just a single portion of the date without needing to build a full time dimension in the schema, which Pentaho BA doesn't facilitate in the web server.
Here's the XML schema generated by Pentaho BA from the MySQL data source:
<Schema name="k_olap">
<Dimension name="diDate">
<Hierarchy name="hDate" hasAll="true" primaryKey="ID">
<Table name="post" schema="kn"/>
<Level name="mDate" uniqueMembers="false" column="ddate">
</Level>
</Hierarchy>
</Dimension>
<Dimension name="diLocation">
<Hierarchy name="hLocation" hasAll="true" primaryKey="ID">
<Table name="post" schema="kn"/>
<Level name="mLocation" uniqueMembers="false" column="location" type="String">
</Level>
</Hierarchy>
</Dimension>
<Cube name="k_olap">
<Table name="post" schema="kn"/>
<DimensionUsage name="diDate" source="diDate" foreignKey="ID"/>
<DimensionUsage name="diLocation" source="diLocation" foreignKey="ID"/>
<Measure name="mesLocation" column="location" aggregator="count" formatString="Standard"/>
</Cube>
</Schema>
Create a proper date dimension and hierarchy which has the day of week as a column in the table, then use that.
See here:
http://type-exit.org/adventures-with-open-source-bi/2010/07/a-simple-date-dimension-for-mondrian-cubes/