Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
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.
User | Count |
---|---|
139 | |
113 | |
103 | |
73 | |
63 |
User | Count |
---|---|
135 | |
126 | |
110 | |
70 | |
61 |