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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
epmck11
Frequent Visitor

Sum column values based on another column from second table

Hello,

 

A bit new to Power BI here, so go easy on me.

 

I have two tables, table A and table B. Table A has a lot of customer numbers and their revenue for each transaction, while table B just has the distinct customer. I want to create a second column in Table B that has the sum of all the revenue from Table A for each of those customers. How can I do this?

 

Thanks

1 ACCEPTED SOLUTION

@epmck11

 

If for some reason the tables do not have a relationship...you can use this column

 

Column =
CALCULATE (
    SUM ( TableA[Revenue] ),
    FILTER ( TableA, TableA[CustomerNo] = TableB[CustomerNo] )
)

Regards
Zubair

Please try my custom visuals

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

 

Create a relationship from the Customer Name column of Table A (Revenue) to the Customer Name column of Table B (Customers).  Write this calculated column formula in Table B (Customers)

 

=SUMX(RELATEDTABLE(Revenue),[Revenue])

 

Hope this helps.


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

Hi @epmck11

 

If the 2 tables are related to each other via customer column...then you can use this calculated column

 

Column =
CALCULATE ( SUM ( TableA[Revenue] ) )

Regards
Zubair

Please try my custom visuals

@epmck11

 

If for some reason the tables do not have a relationship...you can use this column

 

Column =
CALCULATE (
    SUM ( TableA[Revenue] ),
    FILTER ( TableA, TableA[CustomerNo] = TableB[CustomerNo] )
)

Regards
Zubair

Please try my custom visuals

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.