Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hello All,
I have three tables including.
Table1 Table2 Table3
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!
Solved! Go to Solution.
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)
Kind regards,
JB
Hi @Anonymous
leave tables no relationship,
Then create a calculated column in Table1
Column =
IF (
Table1[Method] = 1,
LOOKUPVALUE ( Table2[U_Name], Table2[Temp_Id], Table1[Temp Id] ),
LOOKUPVALUE ( Table3[D_Name], Table3[Id], Table1[Temp Id] )
)
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)
Kind regards,
JB
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
13 | |
13 | |
10 | |
8 | |
7 |
User | Count |
---|---|
17 | |
10 | |
7 | |
6 | |
6 |