I have a bunch of people related data where the only geographical field is "City, State":
Client | Location | Salesperson
Company A | Albany, NY | Joe
Company B | Atlanta, GA | Steve
Company C | Baltimore, MD | Lisa
Company D | Wichita, KS | Suzy
Company E | Portland, OR | Steve
Company F | Spokane, WA | Suzy
Company G | Mobile, AL | Joe
Company H | Elizabeth, NJ | Lisa
That third row is the salesperson. The problem is, each territory is defined by customized regions based off of counties. For example, the New York metropolitan area is defined by the counties listed here.
So a couple questions. First, how do I add in that data to Tableau (where I have all cities and counties). The second is, how can I create somewhere say, I wanted to see performance based on salesperson by region. So like, say I wanted a breakdown of how each sales person performed in the New York Metro area. That would involve me evaluating based on the cities within a customized region based off counties. So in the above table, Lisa's sale in Elizabeth, NJ would be credited as a sale in the New York Metro area.
You'll have to forgive me, I'm a bit of a neophyte in Tableau.
Related
How can I recursively get the breakdown of "Others" when Top N is applied to dimensions?
Imagine a measure Sales Amount is sliced by 3 dimensions, Region, Category and Product, and Top 1 is applied to each dimension. The result I want to see is a table like below. On each slice, the rest of members are grouped as "Others".
Region | Category | Product | Sales
============================================
Europe | Bikes | Mountain Bikes | $100
| |------------------------
| | Others | $ 30
|-----------------------------------
| Others | Gloves | $ 50
| |------------------------
| | Others | $120
--------------------------------------------
Others | Clothes | Jackets | $ 80
| |------------------------
| | Others | $130
|-----------------------------------
| Others | Shoes | $ 90
| |------------------------
| | Others | $110
--------------------------------------------
When an "Others" appears, I want to see the Top 1 of the next dimension within the scope of this "Others". This seems a little tricky. e.g. tuples like (North America, Clothes) and (Central America, Clothes) need to be aggregated as (Other Regions, Clothes). Is there a neat way to aggregate the measure based on the 2nd dimension, Category?
Alternatively, I think a sub cube that filters out Europe will easily provide the breakdown of Other Regions, Clothes and Other Categories. However, this is likely to result in creating many dependent queries. For an easy processing of the result set, it would be ideal if the query returns data in the above format.
Can this be possibly achieved by a single MDX query?
To get the breakdown of others we must use dynamic set, EXCEPT() and aggregate functions
in each of the three dimensions we will need to create a named dynamic set that holds too members (top 1 and others ).
as exemple, in the dimension category i have created a dynamic set that holds two members (Top 1 and others) like this :
CREATE MEMBER
CURRENTCUBE.[Product].[French Product Category Name].[ALL].[OTHERS] AS
AGGREGATE(EXCEPT([Product].[French Product Category Name].[French Product Category Name].MEMBERS,
TOPCOUNT([Product].[French Product Category Name].[French Product Category Name],1,[Measures].[Sales Amount])
));
CREATE DYNAMIC SET [TOP1 and Others]
AS {TOPCOUNT([Product].[French Product Category Name].[French Product Category Name],1,[Measures].[Sales Amount]),[OTHERS]};
because the set is dynamic then the values of top 1 and others will change according to the filters and slicers that you applay.
I've got a few pages on the site describing prices for various products and services in different cities.
For example, on the city page of Paris there is a following table:
+------------------------------------------+--------+
| Ticket for the Eiffel Tower for an adult | 10 EUR |
+------------------------------------------+--------+
| Ticket for the Eiffel Tower for a child | 5 EUR |
+------------------------------------------+--------+
| Ice cream | 2 EUR |
+------------------------------------------+--------+
| . . . | . . . |
+------------------------------------------+--------+
| Taxi from the airport | 14 EUR |
+------------------------------------------+--------+
What is the best way to mark this data using schema.org? Should I use http://schema.org/City or more general http://schema.org/Thing type? Can I use http://schema.org/Product inside city type somehow? And I also wondering how to combine multiple rows in the table together. I'm totally confused and will appreciate any advice.
I have Products and Company tables that look something like this:
Company:
id | name
----------
1 | Google
Products
id | companyId | name
---------------------
1 | 1 | Google Home
2 | 1 | Pixel
Tags
id | name
----------
1 | Consumer Electronics
2 | Computer
3 | Cell Phone
Now I am not sure if I should do a junction table between company -> tags and products -> tags or if there is a way to have one for both or what. When I am searching for companies I want to be able to use the tags for the company and all children products, ie if I search for a Computer and Cell Phone it should find Google. Then if I am searching for Products by Consumer Electronics and Computer, it should return Google Home.
Any help would be greatly appreciated.
I have a group of users who each have a variable that assigns them to a group. I can't share the data, but hopefully this example data will prove to be sufficient.
+-----+-----------+--------------+
| ID | Age Group | Location |
+-----+-----------+--------------+
| 1 | 18-34 | East Spain |
| 2 | 35-44 | North China |
| 3 | 35-44 | East China |
| 4 | 65+ | East Congo |
| 5 | 45-54 | North Japan |
| 6 | 0-17 | North Spain |
| 7 | 65+ | North Congo |
| 8 | 45-54 | East Japan |
| 9 | 0-17 | North Spain |
| 10 | 18-34 | East China |
| 11 | 18-34 | North China |
+-----+-----------+--------------+
My end goal is to create a sheet/dashboard, with a pie chart for age grouping. I want to filter this pie chart based on the Area, however, I want there to be two selections, one for Area (East/North), and one for Country (Spain/China/Congo/Japan). The filters will both be "Single Value Lists", so only one Area and one Country will be able to be selected at a time, but together they will combine to filter the patients. For example, if 'East' was chosen for the Area selection, and 'China' for the Country selection, the pie chart would only show for patients 3 and 10.
This helps reduce the number of selections that a user will have from 8, to 6. I know this isn't much of a difference, but in the actual data there are a lot more permutations and so the reduction would really help when de-cluttering the sheet/dashboard.
I've created the parameters for both Area and Country, but I don't know how to combine the two parameters to effect the patients that are selected.
Let me know if I can clarify anything. If parameters aren't the way to do this, I am also open to other suggestions!
Thanks so much!
Why not split the location into two columns, then create filters for each column? Then you have exactly the functionality that you want just using filters without params and calculations
You could then drag Country onto Area in the data pane to tell Tableau there is a hierarchical relationship between the fields, and set the filter for Country to show "only relevant values", and the filter for Area to show "all values in the database" -- via the little black caret menu at the top right of the filter control.
Then the filter control for Country would only display values for the selected Area.
The other advantage this has is that you wouldn't need to maintain a separate list of parameter values. The set of values would be discovered automatically from your data. If areas or countries appear, get renamed or removed from your database, then you'll see that automatically in the filter choices. With parameters, if Korea unifies or the US splits into red USA and blue USA, you'll see that automatically and not risk preventing access to new data simply because your list of parameter values is out of date.
Create a calculated field that concatenates the values from your parameters and tests it against your location field. Then put that calculated field in your filters card and set it to True.
Calculated field should look like this:
([Area] + ' ' + [Country]) = [Location]
I have a details table of posts and subjects digged from a forum. Row is the single subject (ie postID and subjectIS is the primary key for the table), then I have some measures at subject level and some at post level. For example:
+---------+-------------+--------------+------------+--------------+--------+
| post.ID | post.Author | post.Replies | subject.ID | subject.Rank | year |
+---------+-------------+--------------+------------+--------------+--------+
| 1 | mike | 10 | movie | 4 | 1990 |
| 1 | mike | 10 | comics | 6 | 1990 |
| 2 | sarah | 0 | tv | 10 | 2001 |
| 3 | tom | 4 | tv | 10 | 2003 |
| 3 | tom | 4 | comics | 6 | 2003 |
| 4 | mike | 1 | movie | 4 | 2008 |
+---------+-------------+--------------+------------+--------------+--------+
I want to study the trend of posts and subjects by year and color it by subject.Rank.
Firsts are easily measured putting COUNTD(post.ID) and COUNTD(subject.ID) in rows and 'year' in column.
But if I drag MEDIAN(subject.Rank) in Color, I got a wrong result: it's not calculated at distinct subject.ID level but at row level.
I think I can accomplish it using table calculation features, but I have no idea on how to proceed.
It sounds like you are trying to treat Subject.Rank as a dimension, instead of as a measure. If so, just convert it to a dimension on the worksheet in question by right clicking on the field and choosing dimension. You can also convert it to a dimension in the data pane by dragging the field from the measures section up to the dimensions section. That will tell Tableau to treat that field as a dimension by default in the future.
A field can be treated a dimension in some cases, and a measure in others. Depends on what you are trying to achieve. If you are familiar with SQL, dimensions are used to partition data rows for aggregation using the GROUP BY clause.
Finally, count distinct (COUNTD) can be expensive on large datasets. Often, you can get the same result another way. So try to think of other approaches and save COUNTD for when you really need it.
Try using {fixed [1st LEVEL],[2nd level]: median()}
or
Table calculation approach
when you put in median there is an edit table calculation under advance compute using put you fields in there(Make sure its ordered the way you want it to calculate when you select them) then click OK select the at which level and restart every