Forum Discussion
Help witch fetching values from another table depending on conditions
- 3 years ago
- 3 years ago
I add an extra search value in the LOOKUPVALE() to match the first criteria. In the first line were checking the rule code and supplier, if they match with Data[Code]. We return the NewCategory. Otherwise the DefaultCategory.
Example:IF( LOOKUPVALUE(Rules[Code], Rules[SupplierIDCode], Data[SupplierIDCode], Rules[SupplierID], Data[SupplierID]) = Data[Code] , LOOKUPVALUE(Rules[NewCategory],Rules[Code],Data[Code]) & "From Rules" , LOOKUPVALUE(Suppliers[DefaultCategory],Suppliers[SupplierID],Data[SupplierID]) )
I'm not allowed to upload a file here so try if you get access with this link: https://www.dropbox.com/sh/3lcca8y78bjtzet/AACqz8wG0nGPXXcSrGbu-F9Ma?dl=0
I've added some code to my example, but I worry that all the LOOKUPVALUE() will be very taxing on the system once the real data with maybe 200-300 000 rows are calculated.
I add an extra search value in the LOOKUPVALE() to match the first criteria. In the first line were checking the rule code and supplier, if they match with Data[Code]. We return the NewCategory. Otherwise the DefaultCategory.
Example:
IF(
LOOKUPVALUE(Rules[Code], Rules[SupplierIDCode], Data[SupplierIDCode], Rules[SupplierID], Data[SupplierID]) = Data[Code]
,
LOOKUPVALUE(Rules[NewCategory],Rules[Code],Data[Code]) & "From Rules"
,
LOOKUPVALUE(Suppliers[DefaultCategory],Suppliers[SupplierID],Data[SupplierID])
)