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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Creating a calculated column from another look up table in a Star

 

I have this scenario of a fact table Shipment and 2 lookup tables Brand and euc_brand.

Note: Brand table is nothing but Distinct Brand column from Shipment table.

 

The requirement:  I need Dax for the following

Create a Calculated column (Report Friendly Brand Name) matching Friendly brand names from euc_Brand.   

 

If Brand in the Shipment table (or Brand table) does not have corresponding Friendly Brand Names in the euc_brand table, we display the Brand Name in the calc column, else we use the Friendly Brand Names  from euc_brand.

 

Calc column

Report Friendly brand name = Friendly brand names (from euc_brand), 

But,

If Friendly Brand Names in euc_brand for the brand = Null, then Report Friendly Brand Name = Brand (in Brand table) 

 

 

arikoFather_1-1666649136618.png

Here is the relayionship:

 

arikoFather_2-1666649167917.png

 

arikoFather_3-1666649183871.png

 

 

Thanks Community for your quick help.  

 

3 REPLIES 3
v-luwang-msft
Community Support
Community Support

Hi @Anonymous ,

Could you pls share your sample data and expect output result ,remember to remove confidential data.

 

 

Best Regards

Lucien

Anonymous
Not applicable

Here is dummy data with PBIX:

 

https://1drv.ms/u/s!AlMdRxAveLesgcMbakkZMCLacmOl-Q?e=7wiKq4

 

Expected Result: 

New column to be added to Brand table based on assocated Friendly Brand Names from euc_brand

 

Brand Table:

 

BrandReport Friendly Brand Name
MilkNew Milk
ChocolateNew Chocolate
GarriNew Garri
MoinmoinMoinmoin
SugarSugar

 

Anonymous
Not applicable

I used a LookupValue function:

Report friendly brand names =

VAR _LookedUp =
LOOKUPVALUE(euc_brand[Friendly Brand Names],euc_brand[Brand Names],Brand[Brand])
RETURN
IF ( NOT ISBLANK ( _LookedUp), _LookedUp, Brand[Brand] )
 
Got the desired result:
arikoFather_0-1666693990115.png

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.