WOW2022 W37 Tableau vs. Power BI

 WOW2022 W37 Tableau vs. Power BI

Workout Wednesday 2022 W43 challenge by Kyle Yetter originally done in Tableau, also recreated in Power BI

In this blog i describe my approach in both tools.

Preparation

Tableau

The main challenge was to create a line chart that displays a player’s Career HR by the number of days since their 1st MLB home run without using table calculations.

As the Career and Season HR are already present as a running total in the dataset, the first thing I needed to take care of was creating an axis where all players have the same starting point.


To get the starting point i created a calculation that gave me the MIN (start) date for each player.

For the continuous value for my x-axis i subtracted the minimum date from the date, resulting in a continuous value for each player, starting with 0 up until the end of their career in the observed time period.


To build the basic graph i added the Timeline calculation to columns, Career HR as dimension to the rows and Player names to Colour.
As we have one 
Career HR value per date and i just son't want them to summarize i could also have added the average or max Career HR.

Power BI

To get the continuous value i need for the x-axis of the graph i created a new column.
I calculated the minimum date, removing all the filter context, except for the Player, leaving me with the start date for each player. Then i subtracted this from the date column.


I then added the Timeline column to the X-axis of a line chart, the Average of the Career HR to the Y-axis and the Player names to the legend.

Adding player selection and highlighting


Tableau


First i applied the colours according to the color-palette provided in the challenge.


I then created a calculation that applies the player name for the player selected in the parameter and 'other' for all other players.

This calculation was then applied to colours and the player name to details. The colours for the players were already set, i just needed to add a gray colour to the 'other' value.

Power BI


Power BI does not offer highlighting of a selected value in the line chart, so i had to fake this behavior.

I applied the grey colour to all players.
Then i duplicated the line chart and applied the color-palette to the players on this chart.

On the coloured chart i only want to display the line for the selected player.

Selected Player HR =
CALCULATE (
    AVERAGE ( 'MLB HR Top10'[Career HR] ),
    SELECTEDVALUE ( 'MLB HR Top10'[Player] ) = 'MLB HR Top10'[Player]
)

I added this measure to the Y-axis instead of the average Career HR.
Then i needed a slicer based on the player column for the selection. On the grey colour chart i also had to set the slicer interaction to None.


Now i had to place the coloured chart on top of the grey chart and make sure that axis range, position and size match.

Highlight player's best HR season


Tableau


To display a circle on the date of the player's highest season HR score i created a calculation the returns this date.

And used this to calculate the difference to the minimum date.

This calculation is then used to create a dual axis chart.


What remained was just adding player name and the Career HR value as laber and formatting the chart.



Power BI


To get the value where the highlight circle needs to be placed, i added two more columns.

The 1st column is populated with the Max Season HR value for each player.

MaxSeasonHR = CALCULATE(
    [MAX Season HR],
    ALLEXCEPT('MLB HR Top10','MLB HR Top10'[Player])
)

The 2nd column displays the 'Timeline' value (difference between date and min date) where the MAX Saeson HR score matches the Season HR value.

SeasonHR Timeline =
SWITCH(
    TRUE(),
    'MLB HR Top10'[MaxSeasonHR] = 'MLB HR Top10'[Season HR],'MLB HR Top10'[Timeline])


I copied the coloured line chart with the player selection and replaced the X-axis field with Season HR Timeline.
I placed this graph on top of the others, matching axis range, size and position.
Everything else was again just formatting and arrangement.



Comments

Popular posts from this blog

Power BI vs. Tableau - Eine Übersicht

WOW2022 W43 Power BI vs. Tableau