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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Syndicate_Admin
Administrator
Administrator

Returning Values from a Duplicate Code

Hello! This is working with 2 tables, in which "PEX2 Routes" contains unique values of Routes, while in the "Planning" sheet there are repeated values but the same Routes of the "PEX2 Routes" sheet. My query is, I would like to insert in the "PEX2 ROUTES" sheet the sum of the "Cost" column that contains the "Planning" sheet from its name Route.

Hoja "Ruta PEX2":

Cesardelacruz21_0-1710886032680.png

"Planning" sheet

Cesardelacruz21_1-1710886055467.png

1 ACCEPTED SOLUTION
Anonymous
Not applicable

HI @Anonymous,

You can try to use the following calculated column formula to add a cost column to PEX2 table to summary planning table records:

Cost =
SUMX (
    FILTER ( 'Planning', 'Planning'[Route] = EARLIER ( 'PEX2'[Route] ) ),
    [Cost]
)

Regards,

Xiaoxin Sheng

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

HI @Anonymous,

You can try to use the following calculated column formula to add a cost column to PEX2 table to summary planning table records:

Cost =
SUMX (
    FILTER ( 'Planning', 'Planning'[Route] = EARLIER ( 'PEX2'[Route] ) ),
    [Cost]
)

Regards,

Xiaoxin Sheng

Ashish_Mathur
Super User
Super User

Hi,

Share data in a format that can be pasted in an MS Excel file and show the expected result very clearly.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Daniel29195
Community Champion
Community Champion

@Syndicate_Admin 

 

 

link the two tables on rutas . 

so it will be one to many relationship 

 

then create a calculated column in the table   Ruta PEX2 as  follow  :

 

sumx( relatedtable( Planning , Planning[Costo] )  ) 

 

let me know if this helps .

 

 

If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🙏

Hello! I get that I was only expecting one parameter, not 2.

Cesardelacruz21_0-1710901115600.png

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.