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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
TimvMechelen
Frequent Visitor

Total in table based on other column

Hi all,

 

First of all, I have a material master table which displays if it's a "Old" or "New" material. An "Old" material means that there is a "New" article, which is a replacement for the old article.

I'd like to have a table where I can see the stock of the new material and the stock of the old material in the same row, see below.

 

Currently I have 2 tables, but I don't know how to write the measure for the "Stock Old material number" column:

TimvMechelen_0-1665044875129.png

I'd like to have the following result:

Material NumberOld/New materialOld material numberTotal stock (New)Total stock (old)
4New125100
5New2580
6New 800
7New 30
8New31205
10New 200
11New9010

 

Link to Power BI example file: https://www.dropbox.com/s/x6tlsu9vmzxr992/Supply%20Chain%20Control%20-%20Sample%20data%20Test%201.pb...

 

Help with this would be greatly appreciated! 

 

3 REPLIES 3
amitchandak
Super User
Super User

@TimvMechelen , Try like this Join Table 2 and Table 1 two times. Active join material no and material no

and inactive join material No and old material  no

 

then create measure

 

new Stock = calculate(Sum(Table[Stock]) , not(isblank(Table[Material no])) )

 

 

old Stock = calculate(Sum(Table[Stock]), userelationship(Table[Old Material No], Table2[Material no])  , not(isblank(Table[Old Material No])) )

 

 

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

@amitchandak Is there a way to do this without joining the tables 2 times?

@amitchandak I understand your answer now, I created the relationship between the 2 tables:
However, I still do not get the right answer:

TimvMechelen_0-1665061003284.png

TimvMechelen_1-1665061066363.png

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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