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 August 31st. Request your voucher.

Reply
Anonymous
Not applicable

DAX formula for calculated column to get consecutive text values from two different tables

 

Hello All,

I have three tables including. 

 

Table1                          Table2                                          Table3

t1.pngt2.pngt3.png

I am trying to create a DAX formula as a calculated column over table1 as below:-

 

Username = If(Table1[Method] = 1, Values(Table2[U_Name], Values(Table3[D_Name]))

But somehow it ends up with empty column and I am unable to achieve the task. 

 

Can someone please help me with this DAX formula.

 

Thanks in advance!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous 

 

I think this is something to do with the sequence of events in PBI. Looks like calculate columns are calculated before the relations are enforced. In your case, the formula tries to return an entire column where a single value is expected.

 

The measure below (created as Measure, not a Calculated Column!) does what you seem to need:

Username = 
var TEMP_ID = CALCULATE(MAX(Table1[Method])) 
var U_Name = CALCULATE(MAX(Table2[U_Name])) 
var D_Name = CALCULATE(MAX(Table3[D_Name])) 
return
if(TEMP_ID=1, U_Name, D_Name)

 

PBI.png

 

Kind regards,

JB

View solution in original post

2 REPLIES 2
v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

leave tables no relationship,

Then create a calculated column in Table1

Capture15.JPGCapture16.JPG

Column =
IF (
    Table1[Method] = 1,
    LOOKUPVALUE ( Table2[U_Name], Table2[Temp_Id], Table1[Temp Id] ),
    LOOKUPVALUE ( Table3[D_Name], Table3[Id], Table1[Temp Id] )
)
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi @Anonymous 

 

I think this is something to do with the sequence of events in PBI. Looks like calculate columns are calculated before the relations are enforced. In your case, the formula tries to return an entire column where a single value is expected.

 

The measure below (created as Measure, not a Calculated Column!) does what you seem to need:

Username = 
var TEMP_ID = CALCULATE(MAX(Table1[Method])) 
var U_Name = CALCULATE(MAX(Table2[U_Name])) 
var D_Name = CALCULATE(MAX(Table3[D_Name])) 
return
if(TEMP_ID=1, U_Name, D_Name)

 

PBI.png

 

Kind regards,

JB

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

Top Solution Authors