ActivePivot

ActivePivot

  • Developer Documentation
  • Versions
  • Help

›Copper 2

Information⌃

  • What's new in ActivePivot
  • Changelog
  • Migration notes

CoPPer⌃

  • Introduction
  • The API
  • Flat and Multi-Dimensional Representations
  • Examples
  • Presentation Meta Data
  • Arithmetic Operations and Edge Cases
  • Advanced Topics

Copper 2⌃

  • Introduction
  • API
  • Measures
  • Hierarchies
  • Publication
  • Join operations

ActivePivot WebSocket API⌃

  • Operation description
  • Payload definition

JDBC Source⌃

  • Introduction
  • Source configuration

MDX language⌃

  • MDX Functions

ActivePivot Properties⌃

  • ActivePivot Properties

Measure and hierarchy publication

Publishing a measure or hierarchy is the process through which the Copper context is made aware of its existence. At the end of the Copper calculations, all published measures and hierarchies are added to the cube description.

After a successful publication, a measure or hierarchy becomes available in the following calculations. It can be retrieved by using its name. The name of a measure is either user-defined, or automatically generated by Copper using the its main characteristics (type of measure, arithmetic operator, name of underlying measures, levels of aggregation, ...). The name of a hierarchy is user-defined.

Copper.sum("pnl").publish(context); // measure "pnl.SUM" becomes available
Copper.measure("pnl.SUM")
    .per(Copper.level("currency"))
    .doNotAggregateAbove()
    .as("pnl.SUM per currency") // "pnl.SUM per currency" overwrites "pnl.SUM.per(currency).doNotAggregateAbove()"
    .publish(context); // measure "pnl.SUM per currency" becomes available
Copper.measure("pnl.SUM per currency")
    .multiply(Copper.constant(2))
    .publish(context); // measure "λ(pnl.SUM per currency)" becomes available

Copper.newSingleLevelHierarchy("bucket")
    .from(Copper.level("month").map((Integer m) -> "Q" + (m - 1) / 3 + 1))
    .publish(context); // hierarchy and level "bucket" become available
Copper.measure("pnl.SUM")
    .at(Copper.hierarchy("bucket"), Copper.level("bucket"), (String q) -> findNextQuarter(q))
    .publish(context); // measure "pnl.SUM.at(bucket)" becomes available

For measures

When publishing a measure, all of the intermediary measures used in its definition will also be published. Unless specified so with the use of visible(), those intermediary measures will be hidden in the UI but still available in queries.

Copper.sum("pnl") // creates "pnl.SUM"
    .per("desk")
    .avg()  // creates "pnl.SUM.per(desk).avg()"
    .as("myMeasure") // "myMeasure" overwrites "pnl.SUM.per(desk).avg()"
    .publish(context); // publishes "pnl.SUM" and "myMeasure"

Defining the exact same measure several times across the Copper calculations is not an issue, since Copper can detect when the same measure has already been published, and won't perform the same work twice. However, when the user tries to publish a measure which has the same name as an already published measure, an exception is thrown. If two measures have conflicting names and the second one has no user-set name, then Copper appends a "#" with an incrementing id to distinguish measures.

Copper.sum("pnl") // creates "pnl.SUM"
    .plus(Copper.constant(1)) // creates "λ(pnl.SUM)"
    .publish(); // publishes "pnl.SUM" and "λ(pnl.SUM)"

Copper.sum("pnl") // creates "pnl.SUM"
    .multiply(Copper.constant(2)) // creates "λ(pnl.SUM)"
    .publish(); // does not publish "pnl.SUM" since the same measure already exists and is identical
                // publishes "λ(pnl.SUM) #1" since λ(pnl.SUM) already exists but there is no conflict since the name is not user-set (Coppper is free to choose another name)

Copper.sum("pnl") // creates "pnl.SUM"
    .map((Double d) -> d > 0) // creates "λ(pnl.SUM)"
    .as("λ(pnl.SUM)") // forces Copper to use "λ(pnl.SUM)" as this measure's name
    .publish(context); // throws an exception because "λ(pnl.SUM)" already exists 


← HierarchiesJoin operations →
  • For measures
ActivePivot
Docs
Getting StartedWikiAPI Reference
Community
Stack OverflowLinkedinTwitter
More
Blog
Copyright © 2019 ActiveViam