Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Talos
Frequent Visitor

divide sum of same elements (from one column) by total value for the element (under Totals column)

Hi,

 

I have a table with customers and their region (based on postcode).  What I am trying to do is divide the sum of the customers from that area to total population for that area (which I have in another table, each row having these fields, in this order: area name, area postcode, area total population)

 

Example:

table one

Customer1 - PK13 8JJ

Customer2 - TR11 7LN

Customer3 - IZ2 9TV

Customer4 - PK13 8JJ

Customer5 - TL1 4VS

Customer 6 - PK13 8JJ

 

table two

PK13 8JJ - 1254

KL12 4EW - 1711

IZ2 9TV - 1109

 

So I want: 3/1254 = 0.23%

 

Thank you!

 

 

 

 

 

1 ACCEPTED SOLUTION
bhanu_gautam
Super User
Super User

@Talos , You can achieve this using DAX  create a measure

 

DAX
CustomerPopulationRatio =
VAR SelectedPostcode = SELECTEDVALUE(Table1[Postcode])
VAR CustomerCount =
CALCULATE(
COUNTROWS(Table1),
Table1[Postcode] = SelectedPostcode
)
VAR TotalPopulation =
CALCULATE(
SUM(Table2[TotalPopulation]),
Table2[Postcode] = SelectedPostcode
)
RETURN
DIVIDE(CustomerCount, TotalPopulation, 0)

 

And make sure there is relation between both table your both tables on basis of post code column




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






View solution in original post

1 REPLY 1
bhanu_gautam
Super User
Super User

@Talos , You can achieve this using DAX  create a measure

 

DAX
CustomerPopulationRatio =
VAR SelectedPostcode = SELECTEDVALUE(Table1[Postcode])
VAR CustomerCount =
CALCULATE(
COUNTROWS(Table1),
Table1[Postcode] = SelectedPostcode
)
VAR TotalPopulation =
CALCULATE(
SUM(Table2[TotalPopulation]),
Table2[Postcode] = SelectedPostcode
)
RETURN
DIVIDE(CustomerCount, TotalPopulation, 0)

 

And make sure there is relation between both table your both tables on basis of post code column




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors