The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
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
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
114 | |
81 | |
77 | |
44 | |
39 |
User | Count |
---|---|
150 | |
116 | |
68 | |
64 | |
57 |