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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

sum if contains relationship

table_a

ord_pri
money
nr_ped

----------------------------------------

table_b

ord_pri
money
nr_ped


relationship nr_ped

---------------------------------------

 

jaja.PNGSUM valor of table_a
WHERE ord_pri of table_b
CONTAINS ord_pri of table_a

if (table_b.nr_ped CONTAINS table_a.nr_ped)
SUM(table_a.money)

1 ACCEPTED SOLUTION
Eric_Zhang
Microsoft Employee
Microsoft Employee

@Anonymous

You can try a measure as below. See more detailis in the attached pbix file.

Measure =
SUMX (
    FILTER (
        TableA,
        CONTAINS (
            SELECTCOLUMNS ( TableB, "ord_pri", RIGHT ( TableB[ord_pri], 2 ) ),
            [ord_pri], CONCATENATE ( TableA[ord_pri], "" )
        )
    ),
    TableA[valor]
)

Capture.PNG

View solution in original post

3 REPLIES 3
Eric_Zhang
Microsoft Employee
Microsoft Employee

@Anonymous

You can try a measure as below. See more detailis in the attached pbix file.

Measure =
SUMX (
    FILTER (
        TableA,
        CONTAINS (
            SELECTCOLUMNS ( TableB, "ord_pri", RIGHT ( TableB[ord_pri], 2 ) ),
            [ord_pri], CONCATENATE ( TableA[ord_pri], "" )
        )
    ),
    TableA[valor]
)

Capture.PNG

Anonymous
Not applicable

Thank you so much!!!!

Anonymous
Not applicable

Ops total = 20

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors