Tableau - extra column based om sums - tableau-api

I'm just starting to learn Tableau and I have a question. I have a quarter profits overview as shown in the picture. I like to add a new column based on a calculation rule from the sums in the table (see notes about column Q-dif in paint on the right). How can I add this extra column?
Data is simple overview of all orderlines:
Product x | categorie y | salesprice |
Thank you in advance,
Greetings J.

I have two suggestions. It wont create a column but it will still give you what you may be looking for.
Create a calculated field under "Analysis" and enter this:
(ZN(SUM([Verkoopb..])) - LOOKUP(ZN(SUM([Verkoopb..])), -1)) /
ABS(LOOKUP(ZN(SUM([Verkoopb..])), -1))
Drag newly created calculated field into mark pane
Right click pill and format numbers as %'s
OR get the same results by:
Bringing in a second Verkoopb.. pill under where your original
Verkoopb.. pill is
Right click the second Verkoopb.. pill you just dropped and select
Quick table calculation and select Percent Difference
Drag pill to the pane.
Hope this works.

Related

Difference between two measure totals in Tableau

Using the sample-Superstore data, I am trying to do a table calculation on the row totals, Sum(Sales) -Sum(Profit). I can get the result using this formula
TOTAL(SUM([Sales]))-TOTAL(SUM([Profit]))
But it will also show the value under Ship date 2016/2017,(I only need the total). Any ideas on how to remove the highlighted portion or an alternate way to achieve this?
Try one of two:
1) Try right-clicking the column where your red box is, TOTAL(SUM(SALES))... and then un-check 'show headers'. That will remove the column from your viz, however the calculations and sorting will still be there.
2) Adding the measure-names manually, rather than with the 'measure names' blue-box in the columns. Then, right click the column you wish to hide, and uncheck 'show headers'. That will remove the column from your viz, however the calculations and sorting will still be there. .

How to filter top customers within certain section in Tableau

I have a Tableau file whose source is from one Excel sheet as shown below:
And it's how it looks in Tableau:
I have a Tableau sheet to show me the top 3 customers in each section. For example, company F, H, J, B, A are in section XXX, I filter section XXX only, sort F, H, J, B, A, select the top 3 customers and hit "keep only". So I have a table of top 3 customers in XXX section. Please see the pics below:
My question is, every month I have an updated Excel sheet with same format and I feed it into Tableau, the sales change every month but I always want top 3 customers in each section. For example, top 3 customers this month in XXX section are F, H, J but next month it might be A,B,H. However since I use "keep only" to filter F, H, J, the top 3 customers can only be F, H, J unless I manually change the filter. Is there anyway I can program Tableau to pick up the top 3 automatically whenever I feed new data to this file? I know "filter top n by" can do it but it can only filter by one variable, like they can only filter by sales instead of sales AND sections. I want to use "by formula" in the pic below to do it but I am not sure how to write the formula.
Have you tried to use the "Top" instead of "Condition" tab? You could also try to use a rank.
Create a calculated field "Rank", put index() into it, make it discrete and put it between your segment and customer pillow. Untick "Show header" and use it as a filter on the filter shelf.
I would use the Quick Table Calculation Rank. To do this create a new worksheet as follows:
Drag Section onto Rows
Drag Customer onto Rows
Drag Sales onto text mark
Drag sales onto detail
Right click the sales that you have dragged onto detail. Select Quick table calc and then rank.
Change this table calc from the detail mark onto the rank mark.
Now you can see what it is doing my default. You can see that is will be calculating the rank across all sections. As you mentioned you want the rank per section you just need to adjust the way the quick table calc is working. To do this right click on the measure and select edit table calc. Under Compute using you can change the way the calc is working. Select a couple of different ones to see what is happening. As you have structured the workbook to have Section and then Customer on the Rows shelf you should be able to use pane across then down. This means that it will calculate the rank per pane which in this case is per Section and will calculate down across Customer.
8) You can now drag this measure onto the filters pane and select a range of 1-3 this will filter the view to only show the top 3.
This method will work dynamically even when the data is updated :)

Tableau - Similar function to SQL Group by

I have recently started using Tableau but am still very new to it. I don't know enough of the Tableau vocabulary to be able to find this answer through brute force googling. Hopefully some one here can help point me in a good direction.
I have a simple table of data, containing the columns and types: Date (Date), ID (Numerical), and Status (Text)
I want to be able to generate a report that has: Date, and Percent of the IDs on that date where the Status is "Complete."
In SQL I could do this by running a query along the lines of:
select date, (count(status like "Complete")/count(status)*100) from table
group by date;
Where can I look for this in Tableau? I tried creating a new Calculated measure in the sheet I am working on, but I couldn't find any built in functions that would add this ability. Thanks for any assistance.
So this should be pretty easy. In your tableau screen(when in a sheet) on the left you will see a column which is broken into two. On the top are the "Dimensions"(these are the things you will organise your data on, usually strings or dates) and on the bottom are the "Measures"(these are integers).
So under dimensions you should see "Date" and "Status". In the Dimensions you should see "Number of Records" and "ID"(this is your variable, you can convert it to a dimension by right clicking and selecting that option).
So what you need to do:
You just want status = complete, so drag your "Status" field into the Filter box(just to the right of the dimension column). You will get a pop up of the different types, select "Complete".
This has filtered your data source for only complete rows.
Drag you "Date" field to the "Rows" shelf, on the top of the screen. This will default to the Year of the date.
It will automatically go to a bar chart, change it to a table by selecting "Show Me" on the top right and select the table icon.
Double click on your "Number of Records" measure. This will add it to your sheet. This will now be auto summed per year.
To convert it to % of, right click on the measure in the Marks window(it should look like a green box "SUM(Number ....)"). Right click and select the option "quick table calculation", here select "Percentage of Total".
You will now have the % total per year for all records where status is equal to correct.
(Optional) - To adjust the date dimension, right click on the "Date" Pill(its up the top in the rows shelf). Hear you can see different options for quarter, month, day. You can change it to any of these or a custom data format.

How can I add an Average column to this text table?

I'm building my first dashboard in Tableau and I'm just beginning to learn all the nuances. Right now, I have a basic text table as shown in the image below. I'm trying to add an "Average" column at then end which will give the average per "Assignee" across the 5 fiscal week's shown. I assume there must be a pretty simple way to do this, but I've searched all over and cannot figure it out. I've been able to change the "Grand Total" column to show averages, but not add an additional column so I can display both data points. Can anyone provide some insight into how to make this work?
There are two things you can do:
Go To "Analysis/ Total/ Show Row Grand Totals" and the go to "Analysis/ Total/ Total All Using/ Average" This will give you the row and column averages. Your questions sounds like you want row average but column total, so you should try the second option.
Create a calculated field with WINDOW_AVG(sum([YourMeasure])) (Replace [YourMeasure] with the meassure you want to average. I couldn't see the full name in the screenshot) I will call it AverageMeasure
Then drag the AverageMeasure pill into the rows shelf, right click it and choose "Discrete".
It should look something like this now (I used the Tableau default data set):
If you want to format the number properly, right click on the AverageMeasure in the measures section, choose Default Properties/ Number Format and choose whatever you prefer.

average of calculated rank in tableau

I would like to calculate the average of calculated rank for each competitor variable. I have trouble finding a solution as calculated rank is aggregated value. Can anyone help me with this?
It is the 2015_06 packaged file, and see "sheet 7".
https://drive.google.com/open?id=0B1PGq-fzDlKcWi03emxrQm1wdWs
I had a look at your workbook.
You need to do a change to your calculated field but then you can do it fairly easily with the table calculations.
Change the field Prem Rank to Rank(sum([Premium]),'asc')
Right click on it in the Marks section and make sure that "Compute Using" is set to "Table (Down)"
Create a calculated field with WINDOW_AVG([Prem Rank]) (I called it WINDOW_AVG([Prem Rank])).
Drop it into the column shelf
Right click on AVG(rank) -> Edit Table Calculation -> choose "Compute using: Advanced"
Change the settings according to this picture:
Right click on AVG(rank) again and choose "Discrete"
The result will be a table like this:
I think that is what you are after?