cancel
Showing results for
Did you mean:
Frequent Visitor

## Need help of calculating percentage of population from two tables, many-to-one relationship

Hello,

Need help on calculating the percentage then display the percentage for a selected state in a card.

I have two tables.

Table 1 contains weekly subject counts for each state.

 State Week Counts AL 1 2 AL 2 1 AL 3 5 AL 4 3 GA 1 1 GA 2 5 GA 3 6 GA 4 1

Tabel 2 contains the population of each state.

 State Pop AL 120 GA 150

A many-to-one single direction (table2->table1) relationship was set up. Now I want to calculated the percentage of counts/population for each state and put the percertage in the card. For example. AL will be  (2+1+5+3)/120=0.09

Thank you!

Sam

1 ACCEPTED SOLUTION
Super User II

Hi @Sam10

take a look at the following solution:

``````Percentage Counts/Population =
VAR _StateValue = MIN(Population[Pop])
VAR _SumOfCounts = SUM('Table'[Counts])
RETURN
DIVIDE(_SumOfCounts,_StateValue)``````

With kind regards from the town where the legend of the 'Pied Piper of Hamelin' is at home
FrankAT (Proud to be a Datanaut)

2 REPLIES 2
Super User II

Hi @Sam10

take a look at the following solution:

``````Percentage Counts/Population =
VAR _StateValue = MIN(Population[Pop])
VAR _SumOfCounts = SUM('Table'[Counts])
RETURN
DIVIDE(_SumOfCounts,_StateValue)``````

With kind regards from the town where the legend of the 'Pied Piper of Hamelin' is at home
FrankAT (Proud to be a Datanaut)

Frequent Visitor

Works like a charm! Thank you.

Announcements