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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
jarthda
Regular Visitor

Foreign keys in s SQL model

Should I sum an integer in a parent table based on category in a child table?  This happens automatically in when I sum from a category already in the parent table but does not seem to work for categories in the child table. Is there something I must do? 

 

3 REPLIES 3
amitchandak
Super User
Super User

@jarthda , The information you have provided is not making the problem clear to me. Can you please explain with an example.

Appreciate your Kudos.


Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
v-yingjl
Community Support
Community Support

Hi @jarthda ,

I have created two tables and a measure to try to get it:

parent tableparent tablechild tablechild table

Measure =
SUMX (
    SUMMARIZE (
        'Parent table',
        'Parent table'[ID],
        'Parent table'[Group],
        'Parent table'[Value1],
        'Parent table'[Value2]
    ),
    VAR _id = 'Parent table'[ID]
    VAR _group = 'Parent table'[Group]
    RETURN
        CALCULATE (
            SUM ( 'Parent table'[Value1] ),
            FILTER (
                'Child table',
                'Child table'[Group] = _group
                    && 'Child table'[ID] = _id
            )
        )
)

Best Regards,
Yingjie Li

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

Thank you for this solution. .I see it takes quite a bit in Power BI to agregate across a well defined SQL Schema. I'm wondering why don't I just do it in SQL?  Let me play with it for a while and see how it works. Thanks so much. i will vote up after.

 

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Top Solution Authors