11 Replies Latest reply on Oct 12, 2017 1:00 PM by David Roscoe

# How to display the Max value for part of a string dimension?

I would like to display the Max value for only part of the string. For example, these are unique equipment numbers but I only want to display the highest Build #.  For example, 0304JMSBuild0, 0304JMSBuild1, 0304JMSBuild2.  I only want the display the latest Build#, in this case 304JMSBuild2. I want to display the Max for each equipment. So if I added 0327CAT980Build0 and 0327CAT980Build1, I'd expect the highest value for each equipment to display.  Any help would be greatly appreciated, thanks!!

• ###### 2. Re: How to display the Max value for part of a string dimension?

Hi David

Interesting problem - Try the formula below

{ FIXED split([Product Name],'Build',1): Max(

{ INCLUDE split([Product Name],'Build',1) : max(split([Product Name],'Build',2)

)} )}

You may need to play with it a little - I didn't have a dataset to tetst it against  (I did a simulation against superstore prod names and it seemed to work

Jim

If this posts assists in resolving the question, please mark it helpful or as the 'correct answer' if it resolves the question. This will help other users find the same answer/resolution.  Thank you.

• ###### 3. Re: How to display the Max value for part of a string dimension?

You can use some of the string manipulation calculations to extract the build number from the equipment. then aggregate. You could do this in one calculation, or extract the string in one, and aggregate in another.

If, for example, your build numbers never go past 9, it could be as simple as int(right([Equipment],1)) , which extracts the rightmost value, and returns it as an integer that could be aggregated.

If build numbers go beyond a single digit, you'll have to get more creative on extracting with a combination of nested functions, like find().

If you want to filter the data down to only the most recent build for each equipment, it will get a little fancier. For example,

int(right([Equipment],1)) = {Fixed left([Equipment],len([Equipment])-1: max(int(right([Equipment,1)))}

This formula extracts build from the equipment ( "int(right([Equipment,1))" ), then compares it to the highest value that exists for any row sharing the Equipment value minus the last digit ( "left([Equipment],len([Equipment])-1" ). If the max build is equal the build on the current row, it will return true, which you can then toss into a filter.

Without sample data, much more exploration would start to get pretty confusing, but hopefully this unclogs the blocker a bit for you.

1 of 1 people found this helpful
• ###### 4. Re: How to display the Max value for part of a string dimension?

Hi David,

There are different ways to achieve this. I have used the Split option in tableau to achieve this.

PFA of Workbook. HTH !

2 of 2 people found this helpful
• ###### 5. Re: How to display the Max value for part of a string dimension?

Thanks everyone for the quick feedback. Sounds like you all may be close but I couldn't get it to display correctly or have a valid calc. Attached is the workbook to help test your ideas.

• ###### 6. Re: How to display the Max value for part of a string dimension?

David

Could not open the data - please include as a packaged workbook - you may need to export

Jim

• ###### 7. Re: How to display the Max value for part of a string dimension?

Sorry, try this one. It's exported as a packaged workbook version 10.2

• ###### 8. Re: How to display the Max value for part of a string dimension?

Hi

still can't open - this is what comes up

Jim

• ###### 9. Re: How to display the Max value for part of a string dimension?

This worked! Just had to add a parentheses after the -1. Thank you so much!!!!

• ###### 10. Re: How to display the Max value for part of a string dimension?

Not sure why it's not working. I'm exporting it as a packaged workbook .twbx.  I was able to use Justin's formula of:

int(right([Equipment],1)) = {Fixed left([Equipment],len([Equipment])-1: max(int(right([Equipment,1)))}

• ###### 11. Re: How to display the Max value for part of a string dimension?

Thanks for the help! I get an error when I open.

• Error(123,74): attribute 'selection-relaxation-option' is not declared for element 'pane' (id: C:\Users\droscoe\AppData\Local\Temp\TableauTemp\3759956056\Book1-split (4).twb)

Not sure why it's not working. I'm exporting it as a packaged workbook .twbx.  I was able to use Justin's formula of:

int(right([Equipment],1)) = {Fixed left([Equipment],len([Equipment])-1: max(int(right([Equipment,1)))}