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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Meena
Frequent Visitor

Join 2 tables and calculate different totals

Hi,

 

I have 2 tables as below. I have a requirement to calculate differeent totals based on different joins between the tables.

(1) Budget,Actual Sales by SalesRegion

(2) Budget,Actual Sales by Sales manager

(3) Budget, Actual Sales by Sales Region, product etc.

How to do it?

                                                                                                           

SalesRegionProductBudget
AsiaBike100
AsiaCar100
EuropeBike300
USABike200
CanadaCar200

 

SalesManagerSalesRegionProductSales
ABCAsiaBike5
ABCAsiaCar5
DEFUSABike50
XYZCanadaCar10
    
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Meena ,

 

Here I suggest you to create inactive relationship between two tables.

RicoZhou_0-1666855074486.png

Actual Sales by SalesRegion =
CALCULATE (
    SUM ( 'Table (2)'[Sales] ),
    USERELATIONSHIP ( 'Table'[SalesRegion], 'Table (2)'[SalesRegion] )
)
Actual Budget by Sales manager = 
VAR _ADD = ADDCOLUMNS('Table (2)',"Budget",CALCULATE(SUM('Table'[Budget]),FILTER('Table','Table'[SalesRegion] = EARLIER('Table (2)'[SalesRegion])&& 'Table'[Product] = EARLIER('Table (2)'[Product]))))
RETURN
SUMX(_ADD,[Budget])
Actual Sales by Sales Region, product = 
VAR _ADD = ADDCOLUMNS('Table',"Sales",CALCULATE(SUM('Table (2)'[Sales]),FILTER('Table (2)','Table (2)'[SalesRegion] = EARLIER('Table'[SalesRegion])&&'Table (2)'[Product] = EARLIER('Table'[Product]))))
RETURN
SUMX(_ADD,[Sales])

Result is as below.

RicoZhou_1-1666855162668.png

 

Best Regards,
Rico Zhou

 

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

1 REPLY 1
Anonymous
Not applicable

Hi @Meena ,

 

Here I suggest you to create inactive relationship between two tables.

RicoZhou_0-1666855074486.png

Actual Sales by SalesRegion =
CALCULATE (
    SUM ( 'Table (2)'[Sales] ),
    USERELATIONSHIP ( 'Table'[SalesRegion], 'Table (2)'[SalesRegion] )
)
Actual Budget by Sales manager = 
VAR _ADD = ADDCOLUMNS('Table (2)',"Budget",CALCULATE(SUM('Table'[Budget]),FILTER('Table','Table'[SalesRegion] = EARLIER('Table (2)'[SalesRegion])&& 'Table'[Product] = EARLIER('Table (2)'[Product]))))
RETURN
SUMX(_ADD,[Budget])
Actual Sales by Sales Region, product = 
VAR _ADD = ADDCOLUMNS('Table',"Sales",CALCULATE(SUM('Table (2)'[Sales]),FILTER('Table (2)','Table (2)'[SalesRegion] = EARLIER('Table'[SalesRegion])&&'Table (2)'[Product] = EARLIER('Table'[Product]))))
RETURN
SUMX(_ADD,[Sales])

Result is as below.

RicoZhou_1-1666855162668.png

 

Best Regards,
Rico Zhou

 

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

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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
Top Kudoed Authors