Forum Discussion

DataTyp's avatar
DataTyp
New Member
8 years ago
Solved

adding up percentages

Hi all

 

 

Let us say I have data like this 

District & Village

Total Population

Youth

Youth%

A1

500

100

20%

A2

600

300

50%

A3

700

175

25%

A4

200

25

12.5%

B1

400

44

11%

B2

200

16

8%

 

 How do I make sure that the percentages are aggregated rightly as in the table below? Many thanks for the help

District(rural)

Total Population

Youth

Youth%

A

2000

600

30%

B

600

60

10%

    
    
  • Anonymous's avatar
    Anonymous
    8 years ago

    Well if your youth% is a measure, it will do that correct automatically!

     

    Your formula for youth% should be something like:

     

    Youth%=SUM(Youth)/SUM(Total Population)

     

    If you now display it as Districts only (you can split the column District & village for example), the calculation will still work, but with a different Evaluation context. It will now sum all the total populations in district A together, and all the youth, and generate the correct percentage.

     

    Hope that helps!

     

    Jaap

  • Anonymous's avatar
    Anonymous
    8 years ago

    HI DataTyp,

     

    If 'Youth %' is a measure, you can add a calculate column to store new category and use new category to summary visual.

    Measure Youth % formula:

    Youth % = SUM(Test[Youth])/SUM(Test[Total Population])

    Steps:

    1. Add calculated column district(rural).

    District(rural) = LEFT([District & Village],1)

    2. Create new table visual with above column, change 'Total Population' and 'Youth' columns' summary mode to 'SUM'.

     

    Regards,

    Xiaoxin Sheng

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Well if your youth% is a measure, it will do that correct automatically!

     

    Your formula for youth% should be something like:

     

    Youth%=SUM(Youth)/SUM(Total Population)

     

    If you now display it as Districts only (you can split the column District & village for example), the calculation will still work, but with a different Evaluation context. It will now sum all the total populations in district A together, and all the youth, and generate the correct percentage.

     

    Hope that helps!

     

    Jaap

  • Anonymous's avatar
    Anonymous
    Not applicable

    HI DataTyp,

     

    If 'Youth %' is a measure, you can add a calculate column to store new category and use new category to summary visual.

    Measure Youth % formula:

    Youth % = SUM(Test[Youth])/SUM(Test[Total Population])

    Steps:

    1. Add calculated column district(rural).

    District(rural) = LEFT([District & Village],1)

    2. Create new table visual with above column, change 'Total Population' and 'Youth' columns' summary mode to 'SUM'.

     

    Regards,

    Xiaoxin Sheng