Reputation: 23
So, I have a data set for Clients. The data set mainly has 3 columns that I am concerned with; Client Name - name of the client, Event Data - when the event was held, and Event Success - was the event a success or not. From this, first I want to rank events for each client by the event date; the event with the earliest date would be the 1st event for the client and so on. Next, I want to plot the success rate of events depending on the event number i.e. the first events are usually a 50% success while the 3rd events have a success rate of 75%.
In tableau, I have tried using the RANK function in a couple of ways to no success. It only works in table visualizations which contain measures/dimensions used in the rank formula to achieve a category-wise rank. Is there some other way to achieve this?
The following is the kind of final visual I would ideally want:
Thank you!
Upvotes: 2
Views: 648
Reputation: 26218
@Hassan I think rank function works in tableau as per context only. As soon as the visualization is changed, the results are changed also. However, this can be achieved so easily in R or python by writing a simple code. Still, if you have a low number of events say 4 (as per image of your desired visualization attached) you can do it manually by adding that many calculated fields plus one. Let me show you how.
Steps
{Fixed [Client Name] : Min [Event Data]}
Second event date
{FIXED [Client name] : MIN(
IF [Event Date] > [First event date] THEN [Event Date] end)
}
3 &4. Repeat step 2 for third and last event date
IF [Event Date] = [First Event Date] THEN "First Event"
ELSEIF [Event Date] = [Second Event Date] THEN "Second Event"
ELSEIF [Event Date] = [Third Event Date] THEN "Third Event"
ELSE "Fourth Event"
END
Please check with your data and respond.
Upvotes: 1