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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
damit23183
Microsoft Employee
Microsoft Employee

Logic to calculate measure when two tables do not have direct relationship.

Hi, 

I have two tables as seen below,

Fabric Screen shot.png

and 

Fabric Screen shot.png

I want to calculate Relative Risk based on this formula;

RR = IE(CE+CN)/CE(IE+IN)

 

 

IE = Total ID where Race = African or Asian or White or UnKnown From Table A

CE = Total ID where Race = White from Table B

 

IN = Total ID where Race = African or Asian or White or UnKnown From Table B

CN = Total ID where Race = White from Table B

(Total ID from Table B should not exists in Table A), therefore based on given value above RR formula should be like this,

 

Final Result I would like to see;

 

RR =  1(3+3)/3(1+1). 

 

NOTE : There is no relatinship between these tables except some ID.

 

I want to create dynamic logic where other categories like Gender, Ethnicity, Race, Agegroup should be calculate.

Also, here CE and CN are reference number from each categories. i.e in current example I have used WHITE as Race categories , but gender it will be M, for Age group it will 50-60.

 

If you have questions please let me know happy to answer everything.

 

Thanks

 

3 REPLIES 3
damit23183
Microsoft Employee
Microsoft Employee

Thank you guys for your response. I tried both the solutions you have provided but could not get expected answer. Therefore, i decieded to do everything in SQL and just pull measure from table.

 

Everything working fine from SQL as expected. But, thanks for your suggestion as I came to know something new.

 

Thanks

Anonymous
Not applicable

Hi, @damit23183 

 

I am happy to help you, but according to your description there are a few points of uncertainty you need to answer, which is important to solve your problem.


1. Why are the IE and IN values 1, and how did you arrive at this result?
2. Are you sure Table B id value is not a consecutive number but the table shows 1, 2, 6, 7, 8?

 

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

amitchandak
Super User
Super User

@damit23183 , Append two tables after adding a flag for Table 1 and Table 2 and then create these measures

 

Second create common dimensions like Race , gender and ID, and then you can analyse them together with common dim

Power Query: When I asked you to create common tables: https://youtu.be/PqfGW6pl1Sw
DAX: When I asked you to create common tables: https://youtu.be/a2CrqCA9geM
https://medium.com/@amitchandak/power-bi-when-i-asked-you-to-create-common-tables-a-quick-dax-soluti...

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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