Showing posts with label Salary. Show all posts
Showing posts with label Salary. Show all posts

Thursday, April 24, 2014

Tableau Data Blending with No Common Dimensions

Sometimes when you're working with data, there is a need to compare datasets that don't really have anything in common.  This issue came up with my Sports Viz Show Me The Money: I had a dataset that contained the top 100 earning athletes in 2013 and I wanted to show what their pay could buy for them at an individual item level with out creating an unnecessary Cartesian product..  
Athlete data: a single row per athlete
As Gru would say: Light bulb!  If I create a data set containing a row for each purchasable item repeated the maximum amount of times it would appear (aka the number of times the top earning athlete, in this case Tiger Woods, would be able to purchase it), then I could write a calculated field that blended the two sources and did my filtering for me.

Stuff to buy data: note there is no column mentioning athlete
Doing this gave me two data sets: one that was 100 rows deep and the other just over 5,000 rows deep.

Next, after bringing in both data sets into Tableau, I created a cross dataset calculated field on the 'Stuff to Purchase' dataset that would allow me to filter out when the number of items exceeded the athletes pay.
running_sum(sum([Cost]))<=sum([Forbes 100 Athletes].[Pay $])
This way when I add the purchase able items at a data level, it will continue to referenced the accumulated value of the purchases and restrict them to only total that is less than the salary of the specified athlete.

Finally, I added
- RowID into the details
- 'How Many' true false filter to the filter section
    - IMPORTANT: Change the 'Compute Using' to use RowID
- Add the purchase category and item to the filter section
- Added the object's description to shape
- Filtered it for the specified athlete (from the secondary source).
   - This ultimately ended up being a quick filter that allowed me to select different athletes

Now I had my sheet that showed each of the items that the person could buy.
 If I had joined them ahead of time, I would have had a Cartesian product of over 160,000 rows!  This not only saved me data space, but also cut down on the data prep I needed to get dashboard built.  

So the answer all along (to the question that was never asked) was yes, it will blend...even if there are no common dimensions.  Let me know if you have any other questions and feel free to comment.  Thank you!

Thursday, December 12, 2013

How Does Your Favorite NFL Team Spend Its Salary Cap?

NFL Teams are allotted a certain amount of money every year to spend on its players; that money is referred to as the salary cap.  A teams spends its salary cap on players base salaries, various bonuses, severed contracts, practice squad players, and penalties to the team.  Each team has to weigh the existing contracts with valued positions and potential contract extensions before hiring and releasing players.  

Use the visualization below to better understand how your favorite NFL spends its salary cap.  You can select a team, a position, or a player to learn more about the respective team expenses.  

Enjoy and feel free to comment below.


Friday, December 6, 2013

How Does Your Favorite NFL Team Spend Its Salary Cap, Part 2

With the original salary cap posts, fans could look at how their favorite team spent its salary cap across different positions.  In Part 2, fans can see how the spend of their team compares to other teams for specific positions.  For instance, the Atlanta Falcons are spending more money on 1 quarterback (Matt Ryan) than the Minnesota Vikings are spending on 3 quarterbacks (Matt Cassel, Christian Ponder, and Josh Freeman), though both are 3 win teams.

The original spend dashboard is also included on a separate tab if you want to go back and check the original data.

Enjoy!