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
mj29109
Frequent Visitor

Ratio between two tables

 

Hi

 

This is my first post and question, hope someone helps me to resolve my query.

I have two different tables, Table1 (Employee Separations) and Table2 (Headcount). I have imported both tables in Power BI desktop.

 

In excel I can simply divide the separations with headcount to find the Attrition rate, but here in power BI. I am unable to calculate these things. I want the following result mentioned in last highlighted column.

 

 

Untitled.png

 

 

 

1 ACCEPTED SOLUTION

@mj29109

 

You can create a Measure:

 

Attrition = Sum(Separations[Separations])/SUM(HeadCount[HeadCount])

And use it in a table visual 




Lima - Peru

View solution in original post

7 REPLIES 7
tringuyenminh92
Memorable Member
Memorable Member

Hi @mj29109,

 

In case you had 2 tables (Headcount(Month,Headcount) & Separation(Month,Separation)):

 

  • In Modeling, choose new table by expression:

 

Data = SUMMARIZE( NATURALINNERJOIN(Headcount,Separations),Headcount[Month],Headcount[Headcount],Separations[Separations])

 

  • Create calculated column for attrition ( this could be achieved by calculated measure as well )

 

Attrition (%) = DIVIDE(Data[Separations],Data[Headcount])

 

 

Screenshot 2017-01-16 21.11.35.png

 

 

If this works for you please accept it as solution and also like to give KUDOS.

Best regards
Tri Nguyen

@mj29109

 

You can create a Measure:

 

Attrition = Sum(Separations[Separations])/SUM(HeadCount[HeadCount])

And use it in a table visual 




Lima - Peru

Thank you Vvelarde it worked for me... 🙂 i was just missing a single bracket to close the first argument....

This is the simple example what i want to do... first i want to calculate the table 1(Separations) Names, then table2(headcount) Names. once i get the result like 5 separations and 5 headcounts. then i would like to make a ratio of 5 / 5 = 1.

 

Untitled22.png

i am unable to sum because i am counting a areas, so can i use divide measue with count/CountA?

Also I would like to add on top of what @Vvelarde mentioned that there is relationship between botht those tables on a common field.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

There is only "month" is common in both tables. can i make a relationship with the help of months?

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.