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

The FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now

Reply
Anonymous
Not applicable

New column returns sum only when ID is specific

Hello Power BI experts 🙂

 

I ran into a problem, seems easy, but I can't figure it out. 

 

I am creating a new column, a simple SUM (from another column), but I only want this sum to appear only on the row with a specific ID.

 

Heres is an example.

Let's say that I want to SUM a certain column from Table 2, and I only want it to appear in Table 1 when ID =2 

 

My table 1:

ID   Column I need

1          

2         SUM('Table2'[Column])

3         

4         

 

Does anyone know how to do this? 

 

I tried doing a calculate and then filter it to this specific ID but it returns with errors.

 

Thank you for your help 🙂

1 ACCEPTED SOLUTION
v-lionel-msft
Community Support
Community Support

Hi @Anonymous ,

 

You can do like this.

aaa5.PNG

1. Create a column in Table2.

 

Column = 
CALCULATE(
    SUM(Table2[Value]),
    FILTER(
        Table2,
        Table2[ID] = EARLIER( Table2[ID]) && Table2[ID] = 2
    )
)

 

2. Create a column in Table 1.

 

Column = 
LOOKUPVALUE(
    Table2[Column],
    Table2[ID], Table1[ID]
)

 

aaa6.PNG

 

Best regards,
Lionel Chen

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

3 REPLIES 3
v-lionel-msft
Community Support
Community Support

Hi @Anonymous ,

 

You can do like this.

aaa5.PNG

1. Create a column in Table2.

 

Column = 
CALCULATE(
    SUM(Table2[Value]),
    FILTER(
        Table2,
        Table2[ID] = EARLIER( Table2[ID]) && Table2[ID] = 2
    )
)

 

2. Create a column in Table 1.

 

Column = 
LOOKUPVALUE(
    Table2[Column],
    Table2[ID], Table1[ID]
)

 

aaa6.PNG

 

Best regards,
Lionel Chen

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

amitchandak
Super User
Super User

@Anonymous , try like

if there is a join
new column = sum(RELATED('Table2'[Column]))

wthout using related
new column = sumx(FILTER(table2,table2[Id]=table1[ID] && table2[Id]=2),'Table2'[Column])

 

You can change the filter condition as per need

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
Anonymous
Not applicable

Hi @Anonymous

You can indeed use the calculate function here.

The Column would look like this:

Column =
VAR CurrentID = 'Table1'[ID]
RETURN
    CALCULATE (
        SUM ( 'table2'[column] ),
        FILTER ( table2, 'table2'[ID] = CurrentID )
    )

 

 

Hope it helps,

 

Kind regards
Joren Venema

Data & Analytics Consultant
If this reply solved your question be sure to mark this post as the solution to help others find the answer more easily.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.