Calc measure

Discussion forum for PivotCube VCL users. Common questions. Bug and problem reports

Moderator: Alex Zencovich

Calc measure

Postby Iton » Mon Feb 26, 2007 7:40 pm

for example, i have next data

X Region1 Region2 Region3
city1 5 10 7
city2 8 2 5
...
etc


how i can add measure, such as ,
my_measure1 formula = Regions1+regions3

X Region1 Region2 Region3 MY_MEASURE1
city1 5 10 7 12 (5+7, by formula)
city2 8 2 5 7 (2+5,by formula)
...
etc
Iton
User
 
Posts: 11
Joined: Wed Sep 27, 2006 5:49 pm

Postby AlexZencovich » Mon Feb 26, 2007 9:22 pm

It will impossibel with default formula language because if user filter out region2 (or region1 etc) result will...strange. Moreover, result may have value only for region dimension but not for client dimension(for example).
So, if user place another dimension on columns formula should work in another way.

You may use TPivotMap.OnGetCalcMeasure event to override current formula language with your own (you mau use pure Delphi code or any available complex script engine like VBScript, Java, Dream script, PaxScript etc) to make complex formula which will check used dimension, access to cell value etc etc.
You just need to see how get cell value by absolute coordinates (TPivotMap.Cells adn TPivotMap.RowCells and TPivotMap.ColumnCells)

It is not easy task so you may check if you really need that in OLAP engine or simple static crosstab report will enough.
Best regards,

Alex Zencovich
-------------------------------------------------------------------------------------------------------------------------------------------
www.pivotcube.com - OLAP solution for Delphi, C++ Builder and ActiveX environment
AlexZencovich
Site Admin
 
Posts: 580
Joined: Sun Jun 18, 2006 10:09 am

Postby Guillaumep » Wed Feb 28, 2007 1:23 pm

Maybe you could try this :?:

In the dimension editor for Region dimension,
- create a custom group
- put Region1 and Region3 in this group
- validate

You'll get a hierarchy and values for CustomGroup will be Region1 + Region3.

But all measures will be grouped so it may not be what you want.

Have a nice day,
Guillaume
Guillaumep
User
 
Posts: 13
Joined: Tue Jul 18, 2006 11:19 am


Return to PivotCube VCL

Who is online

Users browsing this forum: No registered users and 2 guests

cron