Hi
How do I fill up blank rows from a lookup function with values from a column in my primary table.
Solved! Go to Solution.
@Ucboy4 - There are few ways to do it. You may create column or measure to get matched items using RELATED function, LOOKUPVALUE function, or FIRSTNONBLANK function .
Examples:
Column1=RELATED([one side field of relationship])
Column1= LOOKUPVALUE(tableA[goal field], tableA[linked field], tableB[linked field]))
Column1= CALCULATE (FIRSTNONBLANK ( tableA[goal field], 1 ),FILTER ( ALLSELECTED( tableA), tableA[linked field] = tableB[linked field] ))
Once you look up the value from the foreign table. You can the use IF statement to check whether it is blank or non-blank. ANd, if it is blank, then get value from Primary table column. Example below:
Lookup =
Var ForeignValue = LOOKUPVALUE(tableA[goal field], tableA[linked field], tableB[linked field]))
Return
If (Isblank(ForeignValue), PrimaryTable[Column], ForeignValue)
Hope this helps ! If you need mroe help, please share the screenshots of the tables or upload a sample .pbix file through one drive. Happy to help.
Did I answer your question? Mark my post as a solution! If not, please feel free to ask me.
Also, I would ❤ Kudos if my solution helped. It is a token of appreciation!
Thank you very much !
Perfect!!
thanks a million, it worked
@Ucboy4 - There are few ways to do it. You may create column or measure to get matched items using RELATED function, LOOKUPVALUE function, or FIRSTNONBLANK function .
Examples:
Column1=RELATED([one side field of relationship])
Column1= LOOKUPVALUE(tableA[goal field], tableA[linked field], tableB[linked field]))
Column1= CALCULATE (FIRSTNONBLANK ( tableA[goal field], 1 ),FILTER ( ALLSELECTED( tableA), tableA[linked field] = tableB[linked field] ))
Once you look up the value from the foreign table. You can the use IF statement to check whether it is blank or non-blank. ANd, if it is blank, then get value from Primary table column. Example below:
Lookup =
Var ForeignValue = LOOKUPVALUE(tableA[goal field], tableA[linked field], tableB[linked field]))
Return
If (Isblank(ForeignValue), PrimaryTable[Column], ForeignValue)
Hope this helps ! If you need mroe help, please share the screenshots of the tables or upload a sample .pbix file through one drive. Happy to help.
Did I answer your question? Mark my post as a solution! If not, please feel free to ask me.
Also, I would ❤ Kudos if my solution helped. It is a token of appreciation!
Thank you very much !