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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
gehe_bbe
Frequent Visitor

How to join a value from another table in a calculated column (alternativ a measure)

Hello to All,

 

am struggling with getting a value from another table (InitialStock) in den the table (Sales). I need a custom column or a suitable Measure. I have two main tables, Sales and InitialStock which are connected bei Model over the third table Model. The InitialStock has no date, but a marker vor ActualPeriod (true/false) to distinguish the ActualPeriods InitialStock and the PrePeriods Values.
After getting this InitialStock I want do create a table which ist summarized bei MonthID and Model with the values SalesQty and InitialStock - but the InitialStock should not be summed... I hope it's understandable what I need.

This is the data model an relationsThis is the data model an relations

 

 

 

 

 

 

 

 

 

 

 

 

 

 

I hope anyone could helb me soon, I appreciate your help, thanks a lot.

Steve

2 ACCEPTED SOLUTIONS
v-junyant-msft
Community Support
Community Support

Hi @gehe_bbe ,

May I ask if your requirement is to add this column to the table Sales?

vjunyantmsft_0-1723100540695.png

If yes, then you can use Power Query for that:

vjunyantmsft_1-1723100624590.png

vjunyantmsft_2-1723100647166.png

vjunyantmsft_3-1723100664852.png

 

vjunyantmsft_4-1723100683017.png
And the final output is as below:

vjunyantmsft_5-1723100692443.png


Best Regards,
Dino Tao
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

Hi 

thanks for this approach, at the moment am not sure if it's good to join the tables, but yes, this is a possible way. Afer researching on internet I found out that it could be done in this way:

InitialStock = CALCULATE(SUM(InitialStock[StockQty]),FILTER(ALL(InitialStock),InitialStock[Branch]=EARLIER(Sales[Branch]) && InitialStock[Model] = EARLIER(Sales[Model]) && InitialStock[ActualPeriod] = EARLIER(Sales[ActualPeriod])))

 

I tried it out in the file you send me and it works fine 😊 The name of thie ERALIER function is a little bit confusing but it gets the value of the row in the Sales table which can be uses for the filter.

 

I don't know how to attach the modified file...

 

Regards Steve



View solution in original post

4 REPLIES 4
v-junyant-msft
Community Support
Community Support

Hi @gehe_bbe ,

May I ask if your requirement is to add this column to the table Sales?

vjunyantmsft_0-1723100540695.png

If yes, then you can use Power Query for that:

vjunyantmsft_1-1723100624590.png

vjunyantmsft_2-1723100647166.png

vjunyantmsft_3-1723100664852.png

 

vjunyantmsft_4-1723100683017.png
And the final output is as below:

vjunyantmsft_5-1723100692443.png


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

Hi 

thanks for this approach, at the moment am not sure if it's good to join the tables, but yes, this is a possible way. Afer researching on internet I found out that it could be done in this way:

InitialStock = CALCULATE(SUM(InitialStock[StockQty]),FILTER(ALL(InitialStock),InitialStock[Branch]=EARLIER(Sales[Branch]) && InitialStock[Model] = EARLIER(Sales[Model]) && InitialStock[ActualPeriod] = EARLIER(Sales[ActualPeriod])))

 

I tried it out in the file you send me and it works fine 😊 The name of thie ERALIER function is a little bit confusing but it gets the value of the row in the Sales table which can be uses for the filter.

 

I don't know how to attach the modified file...

 

Regards Steve



lbendlin
Super User
Super User

I have two main tables, Sales and InitialStock which are connected bei Model over the third table Model.

consider appending these tables (or their quantities) instead.  If you put the initial stock as a positive number and the sales quantity as a negative number then you can easily calculate the remaining stock at any point in time.

Thanks, but I have other stock movements like purchase, rearrangements, inventory correctures etc.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.

Top Kudoed Authors