Rank calculation Tableau for the same ID based on date - tableau-api

I am new in Tableau trying to figure out the same results as the picture below. The Rank should be based on Application ID for Start date. Another rank should include the Rank but should be Gud Rank. Any suggestion might be helpful to me.
I have tried Rank(Sum([ID])) but it didn't worked.

Related

How to make all cohort weeks start from 100% mark in Line charts using Tableau?

I'm trying to build a weekly cohort analysis depicted by line charts in Tableau. The problem is that all weeks line should start from 100%.
Below is the process I took :
dropping order date to columns and selecting week number
COUNTD (order id) and in rows
creating a calculated field : first purchase date{ FIXED [User Id]:MIN([Order Date])} and then
Dropping first purchase date to color field
I'm getting weeks depicted as lines (different colors) but can't figure out a way to make all lines starting from 100% point.
Here is the screenshot of what it should look like https://prnt.sc/1uugad5
Link to the dummy data where order_id is unique Dummy Data link . Any help is appreciated
Thanks
To achieve the viz, I used COUNTD([User ID]) instead of order ID.
The x axis represent the difference of weeks between the order date and the cohort date.
Finally, the percent can be found using percent of total quick table calculation and using table across.

Tableau measure count items if between dates

What I am trying to achieve is to get a count of people employed in a particular period.
I have 3 variables:
Employee ID (integer)
Hire date (date)
Termination date (date or null)
Example
the formula I am looking for is something like
if termination_date is null
then
count employee_ID in
dates between Hire_date and max of either hire_date or termination_date
else
count employee ID in
dates between hire_date and termination_date
This aims to show the dynamic of staff level over the time.
I am new to Tableau, not sure how to even start with it. Any suggestions welcome.
This problem will be simpler if you reshape your data to have the following three columns
Employee ID
Date
Action. (where action takes on the values of ‘Hire’ or ‘Terminate’).
Each data row represents one change in status for an employees. If an employee had a termination date, they will have two records in this new format, otherwise just one record showing the hiring date.
You can reshape your data by hand, or leave the original and use Tableau Prep or the Tableau data source page to reshape using a self Union and a few simple calculated fields.
Define a calculated field called Staffing_Change as
if Action=‘Hire’ then 1 else -1 end
Now you can plot the change in staff level over time by putting exact date on columns and sum(Staffing_Change) on Rows. You can use a quick Table calc, Running Sum, to see the net staffing level. For line mark types, I’d use a step style by pressing on the path button on the Marks card. Otherwise, the chart can give the impression of fractional number of employees.

How do I use Tableau to populate the count of each dimension over a time period?

How do I populate the number of purchases and sales per day in tableau?
Here is my Sample Data:
In my first attempt, sales numbers are not counted to the exact date.
In my second attempt, I tried to tabulate by dropping sales date into the rows. However, it returned two figures - purchases and sales.
I have also tried Calculated Field but Tableau is unable to do a "for loop" like python.
First attempt:
After dropping Sales Date into the Rows. This is what I get:
Is there any way to populate it like this? Please help, I am still new to tableau. Special thanks to Fabio Fantoni for the first solution!
Desired Format:
I have another sample data (refer to sample data 2) which I would like to populate in the desired format (refer to desired format 2). In Sample Data 2, the purchase date "15/12/2020" is not reflected in sold dates.
My apologies but I may require some guidance as I am still new to tableau. Thank you in advance.
Sample Data 2:
Desired Format 2:
Based on this sample:
In order to bypass your double count for two different date columns, you may want to cross join your original data with a copy of it on original.Purchase = support.Sold, like this:
Doing so, you just have to create two calculated fields:
count Purchase:
count([Purchase Date])
count Sold:
Count([Purchase Date (Foglio11)])
The only thing you have to pay attention to is that in the second calculus you have to count Purchase date due to your "inverted" cross join.
You should get something like this:

In Tableau, is there a way to only show the first and last date in the table output using the date filter

Tableau will generally show every single date within table output of the date ranges filtered for. Is there a way to only show the first and last date in the table for the date of ranges selected?
I created an image of the desired output in excel. Link below:
Desired output example
Thank you in advance!
The feature that will address your goal is called a Level of Detail (LOD) calculation. They have many uses and take various forms. I suggest reading about the in the online help.
But, to answer your question, the LOD calc to find the first (i.e. minimum) value in a date field called, say, Transaction Date, is;
{ MIN([Transaction Date]) }
The formula for the latest value is left as an exercise for the reader 😊

To put two level of data in one tableau worksheet and aggregate them

I'm building up a supervisor scorecard on Tableau. Basically, there're two parts impacted on supervisor's score. One is supervisor's own performance, eg. there own's lateness. And the other part was their reporting employees' performance, eg. their employees' absenteesim.
My expectation is aggregating all the criteria in dashbaord, and filter supervisor's ID get his scorecard data. Here is a sample of the raw data:
So from the data we can know that for each CSR, they all have their supervisor, and for a supervisor, their reporting supervisor(which should be a manager) is blank.
So I created 3 calculation filed. One is called SUP_ID, and here's the code:
IF ISNULL([SupervisorID]) THEN [EmployeeID]
ELSE [SupervisorID]
END
Another calculation filed is called SUP_Flag, the code is :
[EmployeeID]=[SupervisorID____OLD]
The last one called SupervisorID___OLD], the code is:
IF [ROLE] = 'Supervisor' THEN [EmployeeID]
ELSE NULL
END
With these three calculation field, i'm able to use SUP_ID to filter all the information I want in each worksheet. When I want each supervisor's belonging employee's performance, I'll just use SUP_ID as filter. If I want each supervisor's own performance, I use SUP_ID as well as SUP_Flag to give me the information, and it works very well.
Everything above was done by separate worksheet.
Now my problem is:
There's a field that i need to put is called supervisor's final score, and it combines with both employee's performance score and supervisor's own performance score together in one filed. These two score are both in previous seperate worksheet. I'm thinking to use LOD to aggregate them, but it doesn't work as my expectation.
Here's what i wrote:
Final_Score_Part1(Sup's performance)
{FIXED [SUP_ID],[Supe Flag]: ([EVALUATION SC]*1* 0.2)}
Final_Socre_Part2(Employee's performance)
{FIXED [SUP_ID],[Supe Flag]: ((([LOST TIME %] * 0.6) + ([ATTENDENCE_SC]*0.2) + ([PUNCTUALITY_SC]*0.2)) * 0.5 )}
Final_Score:
Final_Score_Part1 + Final_Socre_Part2
Here's the screenshot that Tableau gave me.
(I've crossed out Supervisor's name)
So you can see that the part1 score was based on Sup_Flag = True, and part2 socre is based on SUp_Flag = Null, so when i aggregate them, it still won't give me the correct score.
Can somebody help me with this? I'll be so apprecaited for your help.
Thanks
Hi #Phani,
As i couldn't upload an image in comment, i've posted the new image here
enter image description here
For Final_Score_Part1(Sup's performance): include the condition
IF [ROLE] = 'Supervisor' THEN calculate the score[]
ELSE NULL
END
The same condition need to be used in Final_Socre_Part2(Employee's performance).