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 all,
I am new to Power BI and I'm stuck in a particular scenario where I want to derive a Column Value from a MappingTable using Column_1 or Column_2 as Column references and display the corresponding values of the ResultColumn against a SearchColumn from my main table.
I am trying to populate my MainTable with a lookup value from a MappingTable, but I am trying to use two different reference columns from the MappingTable. I tried using the same approach as MS-Excel by using two lookup functions inside an IFERROR function.
Formula in Excel:
=IFERROR(VLOOKUP([@Task Name],'MappingTable'!A:G,7,0),VLOOKUP([@Task Name],'MappingTable'!B:G,6,0))
which works absolutely fine in MS-Excel.
Formula I'm trying to use in Power BI:
NewColumn(LookUp Function) =
IFERROR(
LOOKUPVALUE('MappingTable'[ResultColumn],'Task Categories'[Column_1],'MainTable'[Task Name]),
LOOKUPVALUE('MappingTable'[ResultColumn],'Task Categories'[Column_2],'MainTable'[Task Name])
)
This Expression gives the following Error Message: <A Table of Multiple values was supplied where a single value was expected.>
Note: For all the null values in MappingTable[Column_1], there exists a value in MappingTable[Column_2] which I want to use as the reference column if the Column_1 is NULL to display the Output from the ResultColumn in both the cases.
Sample Structure of my Tables:
My MappingTable looks like this:
So basically, I'm performing a lookup to fetch the value from the ResultColumn using Column_1 as reference, where if there is a NULL value, I want to use the Column_2 as reference and fetch the corresponding value from the ResultColumn.
MainTable:
Error Message:
Desired Output:
P.S: Please refrain from suggesting to merge the Column_1 and Column_2 in the first place because I just can't, I need to find out if there's anyway possible to achieve the desired result?
Any kind of input is appreciated.
Solved! Go to Solution.
Hi,
This is the calculted column formula i used in Table2
=IF(ISBLANK(LOOKUPVALUE(mappingtable[Result],mappingtable[Column_1],[Lookup_value])),LOOKUPVALUE(mappingtable[Result],mappingtable[Column_2],[Lookup_value]),LOOKUPVALUE(mappingtable[Result],mappingtable[Column_1],[Lookup_value]))
Hope this helps.
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 |
---|---|
108 | |
100 | |
78 | |
64 | |
58 |
User | Count |
---|---|
148 | |
113 | |
97 | |
84 | |
67 |