Here is OLAPTimeDimension to the rescue. It can be introduced as any other dimension in the OLAPCube schema and then configured to return year, half year, quarter, month and day in any combination.
<mx:OLAPCube id="salesCube" >
<mx:OLAPDimension name="SalesData" >
<mx:OLAPAttribute name="Company" dataField="company" />
<mx:OLAPAttribute name="Region" dataField="region" />
<mx:OLAPAttribute name="Market" dataField="market" />
<mx:OLAPAttribute name="Product" dataField="product" />
<mx:OLAPHierarchy name="Region-Market-Store" >
<mx:OLAPLevel attributeName="Company" />
<mx:OLAPLevel attributeName="Region" />
<mx:OLAPLevel attributeName="Market" />
<mx:OLAPLevel attributeName="Product" />
</mx:OLAPHierarchy>
</mx:OLAPDimension>
<local:OLAPTimeDimension name="Years" dataField="date" />
<mx:OLAPMeasure name="Revenue" dataField="revenue" />
</mx:OLAPCube>
Using this we get the following result where in we can query revenue for different years.
It can be easily extended to query quarters and months by setting includeQuarter and includeMonth to true on OLAPTimeDimension. The source is here.
2 comments:
When I create a flex application in Flex Builder and paste the code for OLAPDemo3.mxml and OLAPDemo4.mxml, I get an error:
1180: Call to a possibly undefined method progress.
..at the line:
private var pbar:progress = new progress;
Of course, OLAPTimeDimension.as is present in the same folder as the mxml files.
The progress.mxml file.
Post a Comment