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
Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.
Welcome to the Power BI Community Show! Jeroen ter Heerdt talks about the importance of Data Modeling.
Mark your calendars and join us on Thursday, May 26 at 11a PDT for a great session with Ted Pattison!
User | Count |
---|---|
341 | |
99 | |
62 | |
51 | |
47 |
User | Count |
---|---|
328 | |
120 | |
84 | |
66 | |
65 |