Ralph
Ralph

Reputation: 265

Tableau maps - binary flag if equal to max of a field

I have a dataset of this general format:

Origin Facility Destination 5-digit-zipcode - There is one row for each possible origin/destination pair "Preference Metric" for that origin/destination pair - the higher, the better

What I want to be able to do in Tableau is create a calculated field that yields a binary result depending upon if the "Preference Metric" for that entry is the maximum metric associated with that destination 5-digit-zipcode.

This binary flag would be dependent upon the current filtering of origin facilities, so if I filter to only 2 origin facilities then the binary flag will find the maximum preference metric between these two origin facilities. if I filter to 35 origin facilities, then the binary flag will find hte maximum preference metric between these 35 origin facilities.

The idea being that I can then use this binary flag as a filtering mechanism then color a filled map based upon the origin facility.

Thanks in advance for any help you can provide.

Ralph

Upvotes: 2

Views: 487

Answers (2)

Ralph
Ralph

Reputation: 265

I forgot to start by saying - I have TB 8.2.0, so LOD is not an option. I will look more into the context filter option.

Upvotes: 0

Alex Blakemore
Alex Blakemore

Reputation: 11896

The boolean calculated field you can put on the filter shelf will need to use LOD calculations to let you compare values computed at different levels of aggregation (i.e. individual rows compared to a the max of a set of rows). Here is an example.

[Preferance Metric] = { fixed [Destination Zipcode] : max([Preferance Metric]) }

The other trick is that if you want this calculation to be affected by filters, say your Origin field, you'll have to move those filters earlier in the operation pipeline than the fixed LOD calculations. The easiest way to do that is to make the filter a context filter.

See the Order of Operations section under Concepts in the online help, and also read about level of detail calcs.

Upvotes: 0

Related Questions