Sales vs Profit Dashboards in Tableau - tableau-api

I'm trying to achieve a viz in Tableau in which If I click on a paramteer value called sales then sales viz should be selected and if I click on parameter value Profit, then profit viz should be displayed.
Can this be done using parameters in the first place?
Or Action filter is the only option?If action filter is the option can I make sure that If I select one parameter say Sales then the other Viz should be hidden automatically.

I found this link in the tableau training tutorial which might be useful for you.
https://www.tableau.com/learn/tutorials/on-demand/advanced-training-parameters
Steps to follow.
1- Create a parameter with data type "string" which will display either Profit or Sales as values.
2- Create a calculated field with case when function to link your parameter to the measures you want to use (in your case sales or profit).
CASE [Parameter - Sales or Profit]
WHEN 'Sales' THEN [Sales] ## assuming your sales dimension is sales.
WHEN 'Profit' THEN [Profit] ## assuming your profit dimension is profit.
ELSE 'Others'
END
This link would be helpful http://onlinehelp.tableau.com/current/pro/desktop/en-us/help.htm#changing-views-using-parameters.html
3- Build your graph
4- Show Parameter control (the one you created in the first step).
Every time you update the parameter, the graph will be updated.
Hope you find this useful.

A simple solution is to put measure values on either the row or column shelf; and measure names on the filter shelf. The show the filter control for measure names.
The downside is that people can choose other measures that you did not intend to expose

Yes, you can do it with parameters. You use a layout container to hold each sheet and then the parameter will filter one and not the other.
See this post for details. http://www.bfongdata.com/2014/10/chart-creation-with-parameters.html

Related

How to dynamically filter based on different column in tableau?

I have two columns site and Profit catgeory.
Site --> A, B, C
Profit Category --> 1,2,3 [ It will be calculated dynamically, when data changes]
Data:
I want to filter site based on profit category.
Workbook:
If I select Site A in filter option, it hsould display all the sites which is in same Profit category as Site A. If Site A falls under Profit Category 1 means all Sites wchich falls under Profit Catgeory 1 should be dispalyed.
I am struck with this. Please help me to solve this.
You need to display a parameter control instead of a filter control.
Parameters are used to hold the (single) response from the user for making a choice. You can reference parameters in many places, including calculated fields. You can then use calculated fields as a filter.
You can combine these features in different ways. In your case, I suggest creating a parameter based on the Site field. Showing the parameter control and allowing the user to select a site. Then building a boolean calculated field to determine whether a record should be included in the analysis or not based on the selected site and the data values in the current record.
Filter on that calculated field and you should be able to get the effect you described.

Tableau KPI prev value depending on variable

am trying to get Previous Sum(of someField) based on a variable value which is an Id.
This is not a table, Im doing a KPI
On Qlik you would do something like:
SUM({<Id={"$(=Max(vVariable),-1))"}>} someField)
But I can not achieve it on Tableau, off course is due to my lack of knowledge, unfortunatelly time is tinking at work and wanted to see if anyone has any input!
Thanks
Assuming you may use a sample input like the Superstore (using sales as metric), this could be what you're looking for:
In red you can see your "variable" which allows you to select a value and in blue you'll find the unique row for the previous value (Order ID sorted).
The first thing you need to to do is creating a parameter based on all the Order ID values:
Then things start to get a bit complicated if you're not familiar with LOD (Level of details) and the order of execution in Tableau, especially for filters.
Assuming that you can get some information on your own (otherwise, feel free to ask), the first thing you nee to to do is to "pre-calculate" the equivalent of a table having a rowe for each Order ID, in which you also have the previous Order ID value.
You can achive this combining Fixed (LOD) and Lookup function, creating this Calculated Field "Lookup Order ID":
LOOKUP( max({ FIXED [Order ID] : MAX([Order ID])}),1)
This is actually just a calculated field that you want to "fix" because you need the filter to act after you have made that previous calculus, and then you shift your data by 1 row backward.
Once you've done that, you just nee to create another calculated field in order to test your parametric value, and it could be something like this "check param":
[Lookup Order ID] = [Order ID param]
Moving this calculated field in the filter section and selecting just "true" values, you'll get that unique rows like in the initial image, showing the previous value (blue) related to the one you select in the parameter drop-down menu (red).

How do I find the average age of users based on value of another column?

I have a dataset for health procedures with each patient listed under Index_Num. Most patients are listed several times as they have had several services. There is a column with their age.
There is another column called Portal_Use, which says "Yes" or "No" based on whether the user is a portal user.
The question I am trying to visualize in Tableau is the Average Age of Portal Users.
I created a group of the Index_Num, but don't know where to go from there. I'm essentially looking for a bar chart that has one bar for portal users and one bar for non portal users with the average age. This would be very easy if there weren't multiple rows per patient.
Based on your explanation I have used below data to generate the sample workbook.
Use your Portal_Use flag as a Columns
Add Age as an AVG value in Row section
From Show me section select the Type of Bar char you needed
Above will give you desired results as per below.
I hope this helps!!!

Static column in tableau but rest all columns dynamic with filtering

I am building a tableau dashboard which has month, region, and account type filter. (Account type can have only two values either New account or old account)
The table in the report should have the following columns:
Month,
Region,
Clicks,
Signups.
Now the issue is clicks are independent of the account type and signups is dependent on the account type.
I am required to create a static clicks columns i.e when a user filters on account type then only signups column numbers change but clicks remain the same.
I have tried multiple ways to create this table but I am unable to reach a solution to this. I also tried creating two workbooks- one with just a clicks column and the other workbook with rest of the columns. After which, I pasted them together side by side in a dashboard. But the formatting looks extremly off and not professional.
Could you please guide me as to how I can achieve this?
You can use a level of detail expression. These are calculated prior to any dimensional filters and therefore will be unaffected by these actions:
Create a calculated field as follows:
{ FIXED [Month], [Region]: sum([Clicks]) }
This will calculate the sum of the clicks per month and region and ignore any filtering on account.
Let me know if this gives your desired result or if we need to refine further.

Showing comparison across groups in tooltip Tableau

I have a dashboard that lets users compare a company selected from a drop down menu (Company A) to another company chosen from another drop down menu (Company B). This then displays stacked bar charts (5 categories) by year. I want to build a tooltip so that when the user hovers over one of the 5 categories in either set of bar charts, it shows a comparison of that category between Company A and Company B. Is this possible, and if so, what is the best way to do this?
My previous answer showed a different approach for the problem without using too many workarounds. This answer will try to give exactly what has been asked.
First thing to understand is that you can't have the values for two different companies if you're filtering to show only one company. That means you'll need to circumvent this by filtering directly on the field.
Step 1: Create the new parameters that will be used as filters.
You want to create two parameters called "Company 1" and "Company 2" that will be used in each view to filter the company on the graphic.
Step 2: Create the new measures with the filter directly in the field.
Now you should create two new measures from your main measure, each one filtering one of the companies accordingly to the parameter, e.g. Sales Company 1 and Sales Company 2.
Step 3: Create a field with the variation and add it at the tooltip mark.
Simply enough, you want a calculated field with the difference between them:
SUM([Sales C1]) - SUM([Sales C2])
Step 4: Update the views and dashboard
Change the measure in each of the views for their following specific measure field, and remove the Company filter. And in the dashboard, substitute your usual filters to the parameter (which will be used to filter both views).
By assuming you have a dashboard with two views, you'll be filtering the [Company] in both of these views, making the value of another company not available to be shown at the tooltip.
If you're not using it yet, you could try a new approach and see the variance between companies by using the Color mark. By adding the [Company] as color, you could turn the Stack Marks off and add the second company in the filter to be able to visualize the difference.