Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How can I calculate the number of dimension 2 divide by the number of dimension 1

Hello,

I have a dynamic array with 2 dimensions (fiscal year and period). I want to calculate the number of user per period and get the pourcentage by the number of user for the fiscal year.

Here is the result i would like to have :

                                        PERIOD

FY          Total     1week     1month     1quarter     1year

2012          100     10%          30%          50%          20%

2011          150     5%            25%          70%          0%

2010          125     20%          20%          50%          10%  

How should I write the expression?

Thanks

1 Solution

Accepted Solutions
swuehl
MVP
MVP

At first glance, I would have recommended something like

= count(User) / count(TOTAL<FY> User)

where User is you field for user and FY is your fiscal year dimension field.

Depending on your needs, you may want to add a Distinct qualifier, like

=count(distinct User) / count(distinct TOTAL<FY> User)

Maybe I am misunderstanding something, but shouldn't your percentages sum up to 100% in one fiscal year? In 2012, I sum up to 110%.

View solution in original post

5 Replies
swuehl
MVP
MVP

At first glance, I would have recommended something like

= count(User) / count(TOTAL<FY> User)

where User is you field for user and FY is your fiscal year dimension field.

Depending on your needs, you may want to add a Distinct qualifier, like

=count(distinct User) / count(distinct TOTAL<FY> User)

Maybe I am misunderstanding something, but shouldn't your percentages sum up to 100% in one fiscal year? In 2012, I sum up to 110%.

Not applicable
Author

Thanks swuehl.

That is what I wanted. It is my mistake for 2012, it should sum up to 100%.

Anonymous
Not applicable
Author

Just out of curiosity,  what does the <FY> syntax do?  I understand it represents the Financial Year field but is it correct in the form displayed?

Regards,

John.

Not applicable
Author

The <FY> will count only the total for each FY.

swuehl
MVP
MVP

John,

please let me just cite (from the Help) the syntax of count here:

count([{set_expression}][ distinct ] [ total [<fld {, fld}>]] expression)

If the word distinct occurs before an expression, duplicates resulting from the evaluation of this expression will be disregarded.

If the word total occurs before an expression, the calculation will be made over all possible values given the current selections, but disregarding the chart dimensions.

The total qualifier may be followed by a list of one or more field names within angle brackets. These field names should be a subset of the chart dimensions. In this case the calculation will be made disregarding all chart dimensions except those listed, i.e. one value will be returned for each combination of field values in the listed dimension fields. Also fields which are not currently a dimension in a chart may be included in the list. This may be useful in the case of group dimensions, where the dimension fields are not fixed. Listing all of the dimensions in the group causes the function to work when the cycle or drill-down level changes.

//end citation

So the syntax is correct, <FY> is the list of field names to the TOTAL qualifier. So one value per FY field value will be returned from count function.

It is not the same as a field name "guard" like [], e.g. used with field names containing spaces.

Hope this helps,

Stefan