Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
I am trying to use lookup function to get account values from two tables into the first table.
Table 1 is the master table and has two primary keys one text and one int, Table 2 is connected with text and table 3 with int to table 1.
I am trying to lookup on table 2 using text column to get the account value and if it is not present(blank) in table 2 then use table 3 using int as primary key to get the account value. I am using the below code.
The impact subtype and impact type are text columns and impact # is the integer.
</>
@Anonymous , Please share a sample. I might use two step approach At a time we can move data from one table to another
refer 4 ways to copy data from one table to another
https://www.youtube.com/watch?v=Wu1mWxR23jU
https://www.youtube.com/watch?v=czNHt7UXIe8
Hi @amitchandak ,
This is the main table
and it is getting data from two other tables with two primary keys
Table 2:
and Table 3
Table 2 and 3 have different primary key datastructure.
If it is blank in table 2, the query should go to table 3 and fetch the corrosonding data and store it in the same column.
Hi @Anonymous,
I'd like to suggest you add an index field to 'table 3', then you can write a measure to use lookupvalue function and if statement to find corresponding values.
Add an index column | Microsoft Docs
Table visual design:
Index and Key_Str from 'table 3' as category, measure as value.
Measure =
VAR currIndex =
MAX ( Table3[Index] )
VAR currAccount =
LOOKUPVALUE ( Table3[Account], Table3[Index], currIndex )
VAR lookupAccount =
LOOKUPVALUE ( Table2[Account], Table2[Key_int], currIndex )
RETURN
IF ( currAccount <> BLANK (), currAccount, lookupAccount )
Regards,
Xiaoxin Sheng
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
99 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
102 | |
87 | |
64 |