It is recommended to get familiar with crossValue, memberValue and filter function before proceeding with this tutorial.
CrossValue function is used to access Indicators from other Data Sets. Since BellaDati 2.9.2, it is also possible to access Attributes by using function such as lastValue() of firstValue().
It receives two parameters:
- Cube name
- Indicator name
Following example returns Students count from Results data set.
Access cross reference function from Formulas help to predefine Cube name.
Cross Reference with and without Drill-down
When cross-referencing values, BellaDati does take in consideration applied drill-downs. That means both data sets need to have the same attribute (same code) and same members.
To display value without drill-down, use the cross value in combination with the function withoutDrillDown. That will display same value for each member.
The same also applies to date and time drill-downs and function withoutDateTime.
In some cases the members might be the same but the attribute code might be different. In that case you need to explicitelly tell BellaDati, which attribute from the referenced data set should be used.
You can achieve this by specifying memberIdentifier as second parameter of crossValue functions. You need to construct you own string with memberValue.
In this example L_COUNTRY_REF is the code of attribute in referenced data set and memberValue is value of current member (name of country).
This will also automatically handle drill-down paths.
Cross Reference with Filter
BellaDati also does not take in consideration filters applied throught view settings. Therefore, you need to explicitelly tell BellaDati in formula definition which filters and how do you want to use them.
Filter can be defined also directly inside the crossValue function:
Multiple conditions can be combined by using the plus sign:
Please note that the value of the filter has to be String, even when it is a numerical value.
Cross Reference with Date
When filtering date, date attribute must be in format 'yyyy-MM-dd'.
filtered date can also defined inside the crossValue function:
You can find more about filters and their combinations in Filtering in Formulas .
Since BellaDati 2.9.2, it is also possible to access Attributes by using operators such as LASTVALUE or FIRSTVALUE.