Post-Aggregation Join of two tables in Tableau - tableau-api

I´m new to tableau and need to do some kind of post-aggregation join, i think. My goal is, to match some data from google search console to some other regional data concerning hotels. This way, i hope to see if hotels for a certain region perform better or worse than their popularity in the google searches would suggest.
I have one table with the hotel-data which looks like this:
Table 1
Here we have three hierarchical region levels. Country, state and region (and some KPI that is aggregated according to the drill-down-level).
Table 2
Table 2 does not follow the hierarchical dimensionality as table 1, but has the same regions.
What i want tableau to do:
I want tableau, to join the regions on the lowest region level, but NOT to aggregate the KPI impressions. So, when i drill-up to the country level, i want the "random KPI" to be summed to 389, but the impressions should be 40.000 only. You might ask yourself why - it´s a different thing if somebody only searches for "country 1" or if he searches for a state or region of this country. For this analysis it is the goal, to not aggregate the impressions for each region.
I would be glad for any hints on how to do this. I thought about doing a blend - which i thought is a kind of post-aggregation join, but i found out, that if i join on the lowest region-level of table 1 with the region-variable of table 2, the impressions always get aggregated.
Thanks everyone!

Related

Tableau make one line out of two if same city name

Does anyone know if I can add two rows together so that I end up with just one row in Tableau (see screenshot)? So, if both rows are city Aachen and one row has a value for cost but not for purchasing power and the other row has a value for purchasing power but not cost, I would want just one row with both values. I am not interested in the columns "Table Name" and "Document Index(...". Thankful for any help!
Manipulating data like that in Tableau is usually no-go. Nevertheless, you can try Tableau prep and you should be able to do what you need here. Or maybe a different tool (even excel).
With that said, even though you have the info in two rows, the default approach for Tableau is always to aggregate data, so even if you have many rows with similar cases, once you take it to a viz using City (for example) as a dimension, this issue shouldn't really matter.

Tableau filter based on multiple parameters?

I have some data like this below
data image see link
I would like to make a dashboard that will show you all the related empires based on what you choose (those that existed at the same time AND those in one of it's regions of influence). For example if I choose Rome then it will only show Egypt, Greek and Gaul and not show Byzantine because it is from a later time and not show China because it is in a different region. See below
See expected result picture in link
The simple way to achieve this task is to "Self-Join"
I would self-join the data again with Inner join on Region and Era
then, to handle the duplicate rows I would create a calculation
[Empire_Data1] = [Empires_Data2]
and put as false in the filter shelf.
then if you drag both Empires field you will the output you are looking for,
Since this is like 20 rows of data, you can perform a self join without any challenge.
But you have a lot of rows as in hundreds of thousands or more then, you might want to prep your data before connecting to the tableau.

Tableau Filter on field which contains MAX of another field

I have a table in Tableau that contains football teams, their top goal scorers and the number of goals these players scored. I would like to filter the table to show the team which has the player who has scored the most goals.
For example, if my table has Team A and Team B, and Team B has the player which has scored the most goals out of every player (in all the teams), then I would like the filter to include only Team B (but show every player in Team B).
This is a good use case for a top filter.
Place Team on the filter shelf.
When defining the filter, choose the Top tab.
Select By field, Top 1, Number of Goals and Max
This tells Tableau to determine the maximum value for the [Number of Goals] field for each Team, and then filter to only include the Team with the top value.
(Note, this approach assumes that there is a single data row per player showing the total number of goals that player achieved. If your data is structured differently, say one data row per player per game, then you might need to revise the approach slightly, perhaps using an LOD calc too)
In SQL, this typically leads to a HAVING clause.
The only downside is if two teams tie for the top position, I believe you will only see one of them in that case.
If that case is important to you, you can get a similar effect using a table calc to rank teams by their max [Number of Goals], setting the tie breaking rule of your choice for the quick table calc, and then using that calc on the filter shelf to only show teams with the top rank. This will show multiple teams if they are tied for top rank.
The table calc approach is more flexible but can be less efficient, especially for large data sets, since the data is fetched from the data source to Tableau for the ranking calculation, and then only some of it is displayed. (Table calc come very late in the processing pipeline) The top filter approach performs the calculations and filters at the data source, and only sends the filtered results back to the Tableau client.

Using both counts and averages in tableau

I've got some data that I'd like to display both the averages and the count for.
For instance, there are 50 People taking a survey. Their names are saved in a Dimension "Raters". They are taste testing several products. These products are saved in a Dimension "Products"
They answer 4 questions. Taste, Texture, Appearance, Uniqueness, all saved in Dimension "Question"
The actual ratings are saved in "Ratings". This is a measure.
I can very easily make a table with Raters on the Rows, Question on the Columns, AVG(Ratings) in the text.
This shows me the average score for each question the rater answered.
It looks like this:
Rater-----Taste-----Texture-----Appearance-----Uniqueness
Joe---------2.2---------4.3--------------3.7-----------------2.4
Bob--------3.0----------1.2-------------3.4-----------------4.4
Sally-------4.5----------3.3-------------4.5-----------------3.2
Jessica---5.0----------3.0-------------2.0-----------------1.0
So far, so good.
Jessica's results look suspiciously integerish. When I look at the background data, I see that she only answered for 1 product.
I'd like to be able to add a column to the right of uniqueness which is the count of all product responses for that person.
I've played with this quite a bit, and I'm not sure that it is possible. Maybe with LOD?
I'd also like to filter the table, so that only "tough" raters are shown. Criteria for this is: Their average response for at least two criteria should be below 3.0. That would include Joe and Jessica.
When I try to do counts based on averages, I run into the "cannot aggregate an aggregate rule".
Is there a way around this? It would be trivial to do in excel with another column, a countif, and a filter.
Thanks,
Chris
Part 1:
You should be able to create a calculated field(Analysis->Calculated Field) and name it something like "Number of Records". In the query box just set it to 1 and select "Okay".
This new field will be selectable in the measures. Drag it into your table in the columns area and it should add a count next to your averages.
Part2:
In your measure values box you should be able to right click you measures. This will bring up a list of options including "Filter". Select this option.
On the SUM(Number of Records) set it to "At Least" = 2. Then right click on the AVG(Ratings) measure and set it to "At Most" = 3
Put Products on the Rows shelf.
Then right click on that Products field on the Rows shelf and change ITT from a dimension to a measure. Be sure to choose Count Distinct for the aggregation.
Finally, right click on the field again and change it from continuous to discrete.
This shows how many different products each person reviewed, no matter how many characteristics they rated. If you want the number of ratings, use count instead of count distinct. Or just Sum(number of records), again set to discrete

How do I calculate market share in Tableau while maintaining a fixed base?

I am looking for a way to calculate market share for a given country but need the base to remain constant. It's my understanding that I cannot utilize the table calculation for "% of total" because obviously it will always be 100%.
Here is the scenario in detail:
I'm looking to add the market share % detail to my dashboard. I have 36 countries as well as seven groups of countries I'd like the user to be able to select. There is a map as well as a drop-down parameter to select these countries/groups. The goal is to have one percentage displayed on the dashboard based on the user's selection. The base will always be the 36 country total sales.
Am I overlooking something obvious? Has anyone had a similar dilemma?