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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Niiru1
Helper V
Helper V

Dividing between two related tables

I currently have 2 tables: Sheet 1 and Census data.

 

I have built the census data to show:

 

Census Data Age/Gender = 
DATATABLE(
"Age Group Name",STRING,
"Male",INTEGER,
"Female",INTEGER,
"Total",INTEGER,
{
{"0-4 yrs",169731,161784,331515},
{"5-14 yrs",344848,330189,675037},
{"15-24 yrs",292492,283960,576452},
{"25-34 yrs",318401,341009,659410},
{"35-44 yrs",368527,378354,746881},
{"45-54 yrs",311036,315009,626045},
{"55-64 yrs",252556,256402,508958},
{"65-74 yrs",184462,189046,373508},
{"75-84 yrs",89313,107191,196504},
{"85+ yrs",23062,44493,67555}
}
)
 
What I'm trying to do is take the count per age group in Sheet1 and multiply it by the Total in the census table
e.g. first value of 0-4 yrs  is 5 therefore (5/331515)*100000 = 1.5
Census Data Age Group1.PNG
 
Thanks in advance
 
1 ACCEPTED SOLUTION
negi007
Community Champion
Community Champion

@Niiru1  Below try to use the below solution

 

1. You can unpivot the data in the second table like below. have one column for age group

 

negi007_0-1605449287835.png

 

2. Then create relantionship between two tables on age group columns

 

negi007_1-1605449360371.png

 

3. create your measure like below

Formula_output = SUM(Census_Data_Week[Value])/SUM('Census Data Age/Gender'[Total])*100000
 
4. You will get below output using the matrix visual.
 

negi007_4-1605449464748.png

 




Did I answer your question? Mark my post as a solution!
Appreciate your Kudos



Proud to be a Super User!


Follow me on linkedin

View solution in original post

1 REPLY 1
negi007
Community Champion
Community Champion

@Niiru1  Below try to use the below solution

 

1. You can unpivot the data in the second table like below. have one column for age group

 

negi007_0-1605449287835.png

 

2. Then create relantionship between two tables on age group columns

 

negi007_1-1605449360371.png

 

3. create your measure like below

Formula_output = SUM(Census_Data_Week[Value])/SUM('Census Data Age/Gender'[Total])*100000
 
4. You will get below output using the matrix visual.
 

negi007_4-1605449464748.png

 




Did I answer your question? Mark my post as a solution!
Appreciate your Kudos



Proud to be a Super User!


Follow me on linkedin

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.