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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
arutsjak90
Helper I
Helper I

Create Related Column from different table splited by field content

Good morning,
I would like to know if it is possible to create several columns from one, calling them by. data in another column using function Related.

 

 

Example below: 

Existing Tab1:

SnapshotMaterialForecast
1X20
1Y30
2X40
2Y60
3X60
3Y90

 

Existing tab2:

MaterialForecastSalesMonth
Y18020001
X1203001

 

What I need:

MaterialSalesForecast1Forecast2Forecast3Month
X20020406001
Y3030609001

 

Forecast column number should be based on Snapshot value from Tab1.

My current simple DAX: 

ForecastKG = RELATED(ForecastCummulative[ForecastKG])
1 ACCEPTED SOLUTION
ibarrau
Super User
Super User

Hi. You can do this, but it wont' create the columns dynamically.  You have to create each column in table 2. When you try to get values from a (*) Table to the (1) Table of the relationship, you have to consider that there are more than one row of tab 1 for each row in tab 2. That is why you must aggregate the values.

Assuming the tables have a relationship with "Material" column, you can try like this, adding new column in tab 2:

Forecast 1 =
SUMX( 
    FILTER(
        RELATEDTABLE(Tab1),
        Tab1[Snapshot] = 1
    ),
    Tab1[Forecast]
)
    

It could also be resolved with calculate if you understand context transition.

 

Hope this helps,
Regards,


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

Happy to help!

LaDataWeb Blog

View solution in original post

2 REPLIES 2
ibarrau
Super User
Super User

Hi. You can do this, but it wont' create the columns dynamically.  You have to create each column in table 2. When you try to get values from a (*) Table to the (1) Table of the relationship, you have to consider that there are more than one row of tab 1 for each row in tab 2. That is why you must aggregate the values.

Assuming the tables have a relationship with "Material" column, you can try like this, adding new column in tab 2:

Forecast 1 =
SUMX( 
    FILTER(
        RELATEDTABLE(Tab1),
        Tab1[Snapshot] = 1
    ),
    Tab1[Forecast]
)
    

It could also be resolved with calculate if you understand context transition.

 

Hope this helps,
Regards,


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

Happy to help!

LaDataWeb Blog

Thank you for your help! It is working fine 🙂 

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.