Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hi,
I have the below Structure where "Table 3" is the main table connected to other 3 sources with details. I'd like to create a formula (calculated column) that will lookup the "Code" value from each detail table by a specific lookup prioritization.
Ex. The search columns will be "Count" and "Order" from Table 3 and the result Column will be "Code" from any of the 3 detail tables.
First it will look for Count value in Table 1, if it finds the value, then it takes the value from column "Code" in Table 1, if the Count value is not found, then it goes to Table 2, if that is not found, then it looks for "Order" value in Table 4 and takes as a response the value from colum "Code" in Table 4.
The expected output will be :
Appreciate all suggestions.
Solved! Go to Solution.
@Greg_Deckler Thanks for your suggestion. However, the full data model is pretty big and I'd like to avoid any bi-directional relationships. I was thinking of a formula like :
Count | Code |
1 | 1234 |
2 | 1235 |
3 | 1236 |
Table 2
Count | Code | Date |
2 | 1237 | 9/11/2020 |
5 | 1238 | 9/12/2020 |
6 | 1239 | 9/13/2020 |
Order | Count | user | name | Gender |
1 | 2 | 432 | AA | M |
2 | 4 | 433 | AB | F |
3 | 5 | 434 | AC | M |
Order | Code | Date | status |
1 | 1239 | 9/13/2020 | Completed |
2 | 1240 | 9/15/2020 | Completed |
4 | 1241 | 9/16/2020 | Completed |
can someone please help to change the above dax to use with text instead of strings.? I am getting the following error:
Function 'SWITCH' does not support comparing values of type True/False with values of type Text. Consider using the VALUE or FORMAT function to convert one of the values.
Thank you in advance.
@Anonymous - To ammend this, maybe try changing your relationship direction to both on Table1 and Table3? So, thinking in your Table:
Table3[OrderID]
Table3[Count]
Table1[Code]
This should work without any calculations if you change that relationship direction to Both
@Greg_Deckler Thanks for your suggestion. However, the full data model is pretty big and I'd like to avoid any bi-directional relationships. I was thinking of a formula like :
Count | Code |
1 | 1234 |
2 | 1235 |
3 | 1236 |
Table 2
Count | Code | Date |
2 | 1237 | 9/11/2020 |
5 | 1238 | 9/12/2020 |
6 | 1239 | 9/13/2020 |
Order | Count | user | name | Gender |
1 | 2 | 432 | AA | M |
2 | 4 | 433 | AB | F |
3 | 5 | 434 | AC | M |
Order | Code | Date | status |
1 | 1239 | 9/13/2020 | Completed |
2 | 1240 | 9/15/2020 | Completed |
4 | 1241 | 9/16/2020 | Completed |
@Anonymous You could use LOOKUPVALUE. How are your Table1 and Table3 related? What columns? And is it
Table1 1->* Table3
?
@Greg_Deckler Table 1 is related to Table 3 as One to Many by Count columns. Thanks.
@Anonymous Can you post that sample data as text? That way I can create a model and test. I realize that there isn't a ton of data to type in but makes it way easier.
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
21 | |
20 | |
19 | |
13 | |
12 |
User | Count |
---|---|
41 | |
29 | |
23 | |
22 | |
22 |