It is recommended to get familiar with memberSum function and its variations before proceeding with this tutorial.

The goal of this tutorial is to display the frequencies of visits based on visit counts in individual countries.

Visit frequencies are defined as formula indicators described below.

Download: Demo structure & data.

## Simple Frequencies

Use **memberSum** function to force BellaDati to aggregate data on specific level. Since frequencies for particular countries are calculated, apply **Country** attribute as **memberSum** parameter.

Formula of this indicator will count frequencies of exactly two visits. Create new calculated indicator and change condition to record other frequencies.

int a = 0 membersSum('L_COUNTRY') { int v = value('L_COUNTRY_COUNT') if (v == 2) { // For 2 visits per interval a++ } } return a

## Frequencies by Categories

Extend **eachMember **function parameters by **Category** attribute to add another dimension to your frequency analysis.

Formula of this indicator will count frequencies of exactly two visits. Create new calculated indicator and change condition to record other frequencies.

int a = 0 eachMember('[L_CATEGORY][L_COUNTRY]') { // Category added int v = value('L_COUNTRY_COUNT') if (v == 2) { // For 2 visits per interval a++ } } return a

## Frequencies by Categories and Regions

Add another parameter to **memberSum** function in order to further extend dimensionality.

Formula of this indicator will count frequencies of exactly two visits. Create new calculated indicator and change condition to record other frequencies.

int a = 0 eachMember('[L_REGION][L_CATEGORY][L_COUNTRY]') { // Region and category added int v = value('L_COUNTRY_COUNT') if (v == 2) { // For 2 visits per interval a ++ } } return a

Note that frequencies will not be displayed correctly when adding another drill-down on the right side of the table in current version. Use filters instead. This can be also combined with report variables.