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
Solved! Go to Solution.
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)
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)
Works like a charm! Thank you.
Check out new user group experience and if you are a leader please create your group
100+ sessions, 100+ speakers, Product managers, MVPs, and experts. All about Power BI. Attend online or watch the recordings.
User | Count |
---|---|
417 | |
187 | |
92 | |
85 | |
62 |
User | Count |
---|---|
468 | |
206 | |
136 | |
103 | |
87 |