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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
RenaudF
Regular Visitor

Create column based on columns in others tables

Hello,

 

 have the following model: 

 

 
RenaudF_1-1668024479729.png

 

 

And I would like to create a column in All Items table which contains text in SAPBW_Items[ExtMatGroupName] if DALI_ProductFam[DALI ProductFamDescription] is empty. (All items are or in SAPBW_Items or in DALI_ProductFam but cannot be in both)

I managed to do it with the following DAX formula:

ProductFamily V2 = 
var _CodeItem = 'All Items'[CompanyCodeItem]
var _DALIItemSkey = LOOKUPVALUE(DALI_Items[DALI ProductFam],DALI_Items[Item_Skey_Bigint],_CodeItem)
var _DALIFamily = LOOKUPVALUE(DALI_ProductFam[DALI ProductFamDescription],DALI_ProductFam[ProductFam],_DALIItemSkey)
var _SAPFamily = LOOKUPVALUE(SAPBW_Items[ExtMatGroupName],SAPBW_Items[Item_Skey_Bigint],_CodeItem)
Return
COALESCE(_DALIFamily,_SAPFamily)

But as the dataset is really huge, the calculation time is a little bit slow... Is a way to improve it? PS: 'All Items'[CompanyCodeItem], DALI_Items[DALI ProductFam] and SAPBW_Items[ExtMatGroupName] are columns of strings.

 
1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

If there is no misunderstanding, a new column in All Items table with the code below shall work:
 
Column = REALTED( SAPBW_Items[ExtMatGroupName]) & RELATED( DALI_ProductFam[DALI ProductFamDescription])

View solution in original post

4 REPLIES 4
FreemanZ
Super User
Super User

If there is no misunderstanding, a new column in All Items table with the code below shall work:
 
Column = REALTED( SAPBW_Items[ExtMatGroupName]) & RELATED( DALI_ProductFam[DALI ProductFamDescription])

Fantastic. Thanks!!!

amitchandak
Super User
Super User

@RenaudF , If the direction of copy is 1- many use related.

if direction of Copy relatedtable

 

example

realtedtable(Table2, Table2[Value])

 

related(Table1[Value])

 

refer 4 ways to copy data from one table to another
https://www.youtube.com/watch?v=Wu1mWxR23jU
https://www.youtube.com/watch?v=czNHt7UXIe8

 

Ideally if the performance is slow, you can consider merge in power query, or better move the calculation to source

 

https://radacad.com/append-vs-merge-in-power-bi-and-power-query

Thanks for links and idea.

Unfortunately the tables are in DirectQuery and I'm not able to use PowerQuery for them.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors