1. A computer-implemented method for calculating a distinct count value from data stored in a hierarchical database, a counting measure being defined in the hierarchical database such that the counting measure is associated with members of a category of data to be stored in the hierarchical database, the method comprising: receiving a query that identifies a first counting measure and a second counting measure, the first counting measure and the second counting measure being defined at creation of the hierarchical database, the first counting measure being a function configured to return a distinct count value of a particular first category of data in the hierarchical database, the second counting measure being a function configured to return a distinct count value of a particular second category of data in the hierarchical database; querying the hierarchical database to identify members of the first category of data and members of the second category of data that are stored in the hierarchical database; retrieving the identified members of the first category of data and members of the second category of data from the hierarchical database and generating a temporary data structure to store the members of the first category of data and the members of the second category of data retrieved from the hierarchical database; and using the temporary data structure to calculate one or more distinct count values for the members of the first category of data and the members of the second category of data that are stored in the hierarchical database.