Do you have your State and County in separate fields? (or if in the same column, a tag that lets you "know" which one is which)?
If you can post a mock up of your data, that'll help get you an exact solution.
For Example, I need to fill the whole California (CA) and only the Clark county in Nevada(NV). Please note that I don't want to fill CA by counties
1 of 1 people found this helpful
Thanks for that...just what I needed
So we can do this by Dual Axis, and by changing the VizLoD for each of the Axis...
First though, I need to only plot the entire State, where the County field = "All"
I created a calculated field
[State - Where ALL]
IF [County] = "All" THEN [State] END
with no ELSE part, the State name, where County doesn't equal ALL is NULL (and so won't get plotted)...I then change the geographic assignment of this field to state.
Once we have that, I bring in the (generated) Long/Lat and place my new [State - Where ALL] field into the detail tile.
I then bring in Long again (on the Column shelf) and this time Add State and County into the Detail (it needs the State too, else Clark, for example, is Ambiguous...whereas Nevada, Clark is not)...as it can't find a county called "All" it doesn't plot these.
I then dual the Axis.
Hope that helps, and makes sense, but let me know if not.
Thank you Simon, Your answer is correct for my question.
I have Tableau 9.3 so I couldn't open your workbook. But I can manage to understand and plot the map with your clear instructions. I've come to know that there is no need to add Longitude again into the column shelf. It'll overlap.
But, My actual requirement is more than this. I need to plot combination of shape and filled map. so, I already used the Dual axis for the shape map.
Is there any way to do that without using dual axis?
So yes you only need to have one extra dual axis (it can be Long or Lat...it doesn't really matter, I just chose Long)
So with the data in it's current form, I don't think there is a way in 9.3...in Tableau 10+ you can create custom territories (which is what it looks like you are doing here), although you'd probably still need to build up the custom territories from county level...
One way will be to create your data from counties...in the attached (9.3), I've brought in all the counties for California, and the one in Nevada. Although Tableau is actually plotting each county, by removing the border, and using some Table Calcs (example for Sales and State Name) I'm able to create measures which are at the state grain (for example).
Although this is a bit of data-prep work, it only needs to be done once (or very rarely) as geographies don't change very much from year to year.
Hope that helps.
The real reason why I couldn't use this way is I have to plot filled area for the whole state/province in Manitoba, Canada also which is not really divided by counties. So the dataset will be like
Country State County
USA CA All
USA NV Clark
Canada MB All
for this, do you have a way to do without using dual axis
So in a single Axis I don't think there is...As you say Canadian counties aren't recognised in Tableau so we can't build up Manitoba from the lower level, although my knowledge of Canadian geographic splits is limited!!
I'm just going to ping Kent Marten (Map guru at Tableau) as he will know which levels, below state, are recognised in Tableau in Canada.
Failing that, we might need to explore the "Custom Polygon" route
Thank you for the suggestion.
As I am thinking to have a zip code as a common geographic role for both US and CA. With that, I think it is possible to achieve the map in a single axis. But unfortunately, I don't have proper source to get the postal code data which have the shapes in Tableau and of course there will a lot of data-preparation.
I'm quite new to Custom polygons, need some training. please let me know if you have easy tutorial link.
It's a shame you are not on Tableau 10+ as zip-codes are now mapped as areas, as well as points!
So in order to get shapefiles into Tableau, there are a few ways depending on your available tech and expertise!
In the world of free...I've put together this "how to" using open-source QGIS to do the job
I've also see a shapefile processed in Python, R, SaptialLite (SQL type extension to the language for spatial files)...and from the not-free side, Alteryx has got a tool (I'm sure there are other ways too).
The potential problem I can see using Zipcodes, and then using them to create custom polygons, is that the data will be (potentially) very large (and you don't actually need the zip-code level in your final version). To plot a polygon we need to take the nodes from the shape-file, and then use Tableau's path to draw that shape (that can mean multiple rows per zip code). I'd suggest creating the geographies you want in QGIS (in GIS software you can layer the maps, so could have a layer by State, Manitoba, and a layer by County, Clark and overlay them). Then this can be flattened and then at this point, you can create the custom polygon...this will reduce the size of the custom-polygon data significantly.
I'd also recommend the mapping videos from Tableau Tableau Training and Tutorials
Hope that helps.
I come to know the new map features in Tableau 10+. I'll see possibility to upgrade my tableau.
Thank you so much for the tutorial.
Good choice...life will be much easier in T10+
Then all you'll need is a list of Zip-codes for each of the States/Counties you require (you can find these on the web pretty easily; look for government census and statistic sites)...you can then put next to each one the level you want it at...and then use the Custom Geographies to aggregate the zip-code to your field
I'd also recommend this great video from Joshua
it covers many new T10 features, but the custom geography part is particularly good (and easy to follow)
Finally, I achieved the map by using the custom polygons. The below discussion helped me.
From Below link, I got the county and state shape files and then I used some R programming to convert the .shp to .csv
Of course, I did some data preparation work.
Anyway, It's good to learn the custom polygons . Thanks for your help.
Good work...yes a very handy skill! (and yes R is a good choice, much easier that my manual version...if you can find the libraries!!)
1 of 1 people found this helpful
Yes, a simple few lines of coding will do the work. example for Canadian provinces below,
Canadastates = fortify(Canada_states)
write.csv(Canada_states,file="Canada_states.csv",fileEncoding = "UTF-8")
write.csv(Canadastates,file="Canada states.csv",fileEncoding = "UTF-8")