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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Mazex1985
New Member

Showing percentage from two different datasets

Hello,

  I have three tables like the below

 

Users

Earnings

Expenses

 

I am showing one table on powerbi, that shows each user with his earnings and expenses next to him, I want to add another column that shows the percentage of earnings over expenses, but when i add that column (sum(earnings)/sum(expenses) to the users table, it's showing percentage for all users,  I need it to be filtering per user, am i doing it wrong

 

Thanks.

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @Mazex1985 

Do you create relationships between Users table and other two tables based on User columns? I would recommend using a measure to get the percentage.

Percentage = DIVIDE(SUM(Earnings[Earnings]),SUM(Expenses[Expenses]))

020403.jpg

 

You can also get it with a calculated column in Users table. Here is a sample pbix.

Column = DIVIDE(SUMX(FILTER(Earnings,Earnings[Users]=EARLIER(Users[Users])),Earnings[Earnings]),SUMX(FILTER(Expenses,Expenses[Users]=EARLIER(Users[Users])),Expenses[Expenses]))

020404.jpg

Kindly let me know if this helps.
Community Support Team _ Jing Zhang
If this post helps, please consider Accept it as the solution to help other members find it.

View solution in original post

4 REPLIES 4
v-jingzhang
Community Support
Community Support

Hi @Mazex1985 

Do you create relationships between Users table and other two tables based on User columns? I would recommend using a measure to get the percentage.

Percentage = DIVIDE(SUM(Earnings[Earnings]),SUM(Expenses[Expenses]))

020403.jpg

 

You can also get it with a calculated column in Users table. Here is a sample pbix.

Column = DIVIDE(SUMX(FILTER(Earnings,Earnings[Users]=EARLIER(Users[Users])),Earnings[Earnings]),SUMX(FILTER(Expenses,Expenses[Users]=EARLIER(Users[Users])),Expenses[Expenses]))

020404.jpg

Kindly let me know if this helps.
Community Support Team _ Jing Zhang
If this post helps, please consider Accept it as the solution to help other members find it.

SpiroswayGR
Resolver III
Resolver III

@Mazex1985 

Did you connect your tables with calendar table ? 

Can you show us the data model ? 🙂

No, I am not using any calendar there, why there shall be a calendar? its not dates dependent.

 

Thanks

I was thinking if you wanna work around with time measures for expences or earning.

 

In that case , either you will try to use cross filter direction = both , so you will able to filter then (not so good solution if you want to expand with more tables and measures).

 

Better solution is to use these dax  (relate and userelathioship) like below  : https://stackoverflow.com/questions/14366192/using-related-function-in-dax-with-userelationship

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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