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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
SCNCKS1
Helper I
Helper I

SUM RESULTS FROM A TABLE IN ANOTHER TABLE IN POWER BI USING 3 DIFFERENT RELATIONSHIPS

hi, i hope someone can help.

i am trying to create a calculated column that returns the sum of results from a table that is not directly related in the model.  I have used treatas, but it isn't working correctly. Also, not sure how to incorporate the greater than function for the date. in the filter. There are more columns in both tables, but the ones showing are the ones that would need to be matched to select the correct total.

 

Client Rates
rateDescriptionproduction uniteffective dateprojectid
2Description1ProductionUnit14/8/2022Project1
5Description2ProductionUnit14/8/2022Project1

 

Production
Production UnitDateprojectidClient Rate Sum
ProductionUnit1greater than or equal to C_R_Effective_DateProject17

 

Thank you!

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@SCNCKS1 , if you are creating a column then you can have

new column in table2

sumx(filter(Table1, Table2[Date] > Table1[Date] && Table2[col] = table1[col]), Table1[Value])

 

refer 4 ways (related, relatedtable, lookupvalue, sumx/minx/maxx with filter) to copy data from one table to another
https://www.youtube.com/watch?v=Wu1mWxR23jU
https://www.youtube.com/watch?v=czNHt7UXIe8

View solution in original post

Worked perfectly! Thank you!

 

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@SCNCKS1 , if you are creating a column then you can have

new column in table2

sumx(filter(Table1, Table2[Date] > Table1[Date] && Table2[col] = table1[col]), Table1[Value])

 

refer 4 ways (related, relatedtable, lookupvalue, sumx/minx/maxx with filter) to copy data from one table to another
https://www.youtube.com/watch?v=Wu1mWxR23jU
https://www.youtube.com/watch?v=czNHt7UXIe8

Worked perfectly! Thank you!

 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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