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.
I am trying to solve the problem of having joins between tables being dynamic.
To do this my thinking is that the join would be based on a column called uniquID but that column itself will be the result of a DAX formula.
The DAX formula needs to do a look up on another table to find out what are the fields that make up the unique ID and then go back to the main table, find those columns, and do a concatenation to come up with the uniqueID.
Is this possible?
Update:
Sample data below. I want to create the UniqueID column using DAX, The DAX needs to do a look up to a setttings table to determine which fields it should concaternate. There are two ways I could think of, of laying out the setttings table.
Main Table
A | B | C | D | UniqueID |
123 | 1 | C | D1 | 1231D1 |
123 | 1 | C | D2 | 1231D2 |
456 | 2 | C | D3 | 4562D3 |
456 | 2 | C | D1 | 4562D1 |
Settings Table
Table | UniqueID fields |
MainTable | A |
MainTable | B |
MainTable | D
|
Alternative settings table
Table | UniqueFIeld1 | UniqueFIeld2 | UniqueFIeld3 | UniqueFIeld4 | UniqueFIeld5 |
MainTable | A | B | D |
hi, @Anonymous
Based on my test, you could try this way as below:
Step1:
In Edit Queries, Add an index column for main table and then duplicate the main table.
Step2:
Select column A, B, C, D column Then unpivot it.
Step3:
Merge it with the settings table by Attribute column
Step4:
Expand the table and filter null value
Step5:
Close&Apply
Then create the relationship between main table and dup main table
Step6:
Use this formula to add a calculate column
UniqueID = CONCATENATEX(RELATEDTABLE('Dup Main table'),'Dup Main table'[Value],,'Dup Main table'[Attribute])
Result:
here is pbxi file, please try it.
Best Regards,
Lin
Thanks - I finally got round to reviewing this solution, I think it might work but the duiplication of the main table is not ideal, especialyl if the main table is rather large. Wil see if I can find any better solution else will awrd this the points.
Maybe. Sample/example data would really help here. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
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 |
---|---|
68 | |
54 | |
53 | |
36 | |
34 |
User | Count |
---|---|
84 | |
71 | |
55 | |
45 | |
43 |