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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
jasmin_w
Frequent Visitor

Calculated Column - SUM values in another table based on IDs equal to each other

I am trying to create a calculated column based on the SUM of values in another table where the IDs match each other. 

 

I have 2 tables: 

  1. Sales Roster - contains one row per Employee
  2. Revenue - contains all revenue data with multiple rows per Employee with multiple employee columns.

 

There is already an existing many-to-one relationship between 'Revenue[Geo Owner ID] and 'Sales Roster'[EmpID]. Most revenue is reported this way and under this relationship. This is considered Core revenue and all revenue is summed under the 'Sales Roster'[EmpID].

 

Additionally I would like to create a calculated column that reports on the revenue a different way, which is Collaboration revenue. I pretty much want it to do this:

 

CALCULATE ( SUM ('Revenue'[Revenue USD]), 'Revenue'[Account Owner ID] = 'Sales Roster'[EmpID] ) )

 

Unfortuntately, it has not been this simple because the 2 tables already have an existing relationship and the 'Revenue' table has many duplicates in the 'Revenue'[Account Owner ID]. 

 

Any help would be appreciated, thank you!

 

Some methods I have attempted:

  1. VAR _revenueID = FIRSTNONBLANK('Revenue'[Account Owner ID], 1)
        VAR _rosterID = FIRSTNONBLANKVALUE('Sales Roster'[EmpID] , 1)
        RETURN
        SUMX(
        FILTER( 'Revenue', _revenueID = _rosterID),
        'Revenue'[Revenue_USD] )
  2. CALCULATE(
    SUM( 'Revenue'[Revenue_USD),
    'Sales Roster'[EmpID] = FIRSTNONBLANK('Revenue'[Account Owner ID], 1 )
    )
 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @jasmin_w ,

I create two tables as you mentioned.

vyilongmsft_0-1720071378173.png

vyilongmsft_1-1720071398177.png

vyilongmsft_3-1720071529688.png

Then I create two calculated columns and get what you want.

Column = 
SUMX ( FILTER ( 'T2', 'T2'[Peiod] = 'T1'[Peiod] ), 'T2'[Amount] )

vyilongmsft_2-1720071500983.png

Column 2 = 
SUMX ( FILTER ( 'T1', 'T1'[Peiod] <= EARLIER ( T1[Peiod] ) ), 'T1'[Column] )

vyilongmsft_4-1720071600721.png

 

 

 

Best Regards

Yilong Zhou

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @jasmin_w ,

I create two tables as you mentioned.

vyilongmsft_0-1720071378173.png

vyilongmsft_1-1720071398177.png

vyilongmsft_3-1720071529688.png

Then I create two calculated columns and get what you want.

Column = 
SUMX ( FILTER ( 'T2', 'T2'[Peiod] = 'T1'[Peiod] ), 'T2'[Amount] )

vyilongmsft_2-1720071500983.png

Column 2 = 
SUMX ( FILTER ( 'T1', 'T1'[Peiod] <= EARLIER ( T1[Peiod] ) ), 'T1'[Column] )

vyilongmsft_4-1720071600721.png

 

 

 

Best Regards

Yilong Zhou

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
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 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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