How to calcuate percentages based on the row total

31 views
Skip to first unread message

Kwong

unread,
Feb 26, 2015, 4:56:10 PM2/26/15
to intersystems-de...@googlegroups.com
 

Hello:

I am using the tutorial as an example.

By choosing the Age Group as Row and Gender as Column, I got this in the query:
SELECT NON EMPTY [GenD].[H1].[Gender].Members ON 0,NON EMPTY [AgeD].[H1].[Age Group].Members ON 1 FROM [Test Tutorial]
 
I got numbers in the table, the question is how to convert the numbers into percentage by the row (not by the column)

 

Age Group    Female         Male            would like to see             Female         Male

0-29                2080          2077                                                    50%             50%

30-59              900            600                                                      60%             40%          

60+                  20               80                                                      20%             80%

 

I created a Calculated Dimension of RowSum (Aggregate([AgeD].[H1].[Age Group].Members)), it gives the total for each row that is correct.

The problem is that my Calculated Measure PercentAge (100*CurrentMember/RowSum) only gives me 100% for each cell.  Here is the query:

ECT NON EMPTY NONEMPTYCROSSJOIN([GenD].[H1].[Gender].Members,{[MEASURES].[PERCENTAGE]}) ON 0,NON EMPTY [AgeD].[H1].[Age Group].Members ON 1 FROM [Test Tutorial]

 

Anyone knows how to fix this?

 

I probably get some of the concepts mixed up.

Any help is greatly appreciated.

Thanks

-Kwong
 

 

Reply all
Reply to author
Forward
0 new messages