IBM Apptio

 View Only

 Lookup Contains Formula

Jump to  Best Answer
  • CostingStandard(CT-Foundation)
Apptio Community Member's profile image
Apptio Community Member posted Fri January 06, 2023 05:23 AM
​​​

Hi,

 

Wondering if anyone knows the best way to use this Lookup Contains Excel formula in TBM Studio?

I've tried in the usual Apptio format for a lookup and can't seem to find anything on a lookup contains or partial match formula in the guides.

 

=VLOOKUP("*"&<Partial Value>&"*",<lookup range>,<match column position>,0)

 

I have several hostnames that have become unallocated because they are not identical in the two data sources, one has additional text .

 

Thanks in advance


#CostingStandard(CT-Foundation)
Apptio Community Member's profile image
Apptio Community Member  Best Answer

Based on your excel formula it seems there is a deterministic way to identify these hosts, I would cleanse the data in the target table​ so it's in the same structure as your source table resulting in the lookup working.  Essentially was @Rene Norskov said here 

"Rather than using the data / server names as is, you could create a cleansed version of the server name that you use for lookup. The cleansed version could be all uppercase and truncated as required. You could also replace or remove particular words in the server name - words that you don't want to include in the comparison/matching of server names.  This is typically a very performant solution."


If there isn't a deterministic way to clean the data, the other suggestions would all work, as far as which performs the best it really depends on the actual length and type of the data being worked on.

When designing your solution, whichever one has to read the fewest characters technically would perform the best.

Left/Mid/Right are better than search as they are a defined number of characters, while search has to search the whole string.  Using Regex will perform as well as it does, but it will perform worse that something simple like Left()

How much this all matters really just depends on how large of data you are working with something like 10,000 to 20,000 records it probably doesn't matter,

If you have a really large table 1,000,000+records and very FEW need this logic, it can perform better to split the table into 2, do the expensive string logic on the bad records, and append them back in.

I'd suggest implementing whichever solution seems the best based on your data, and assessing what the impact to your calculation is, most of the time for stuff like this is should be pretty minor, unless as I said, these tables are large and the string values are very long.


#CostingStandard(CT-Foundation)
Jenny Franklin's profile image
Jenny Franklin
Hi @Lucia Doyle, others may have a better way of doing this, but in the past, I would create three columns for this type of situation.  Create one column using a Search function to see if what you're looking for is found; create another column using the typical Lookup function; and then create another column that says if your Search column is not blank, then return your Lookup column.  You could do an If/Lookup in the same formula, but I tend to stray away from those because it can create performance issues (at least that's what I've heard).
#CostingStandard(CT-Foundation)
Guillermo Cuadrado's profile image
Guillermo Cuadrado
We have done many times what @Jenny Franklin suggests below, @Lucia Doyle. Breaking down complex logic in smaller chunks works well for us.
Also, sometimes we have to split the formulas across different pipeline steps., i.e. by inserting an empty Hide & Rename between two Formulas.​ Not only might this improve performance, but also avoids some timing problems, where some columns wouldn't calculate properly, possibly because of a race condition.
#CostingStandard(CT-Foundation)
Rene Norskov's profile image
Rene Norskov

@Lucia Doyle The Lookup_Wild() functions seems to be direct replacement for you.  Lookup_Wild() supports regular expressions in the matching column.  Note that regular expressions are slightly different to the wildcards used in Excel.  E.g. you would use .* (period+asterisk) instead of just * as in Excel.  Check this post: use of Lookup_Wild and regular expressions

Rather than using the data / server names as is, you could create a cleansed version of the server name that you use for lookup. The cleansed version could be all uppercase and truncated as required. You could also replace or remove particular words in the server name - words that you don't want to include in the comparison/matching of server names.  This is typically a very performant solution.

You could also consider used the TableMatch() function, but I would not apply this for a large number of records.
#CostingStandard(CT-Foundation)