Hi all,
I've spent a while trying to find a preexisting answer to this, so apologies if one is already out there.
I have a line graph of various currency values against the dollar over time. The underlying dataset contains nominal units of currency per dollar for each day, but also the percentage change since the first data point (01/01/2014, and the data is daily and continues to 25/08/2015).
I would like to make the date range dynamic, and have the graph recalculate to display a line of the percentage change between the currency value of the end date and the start date.
I would like the end product to be a graph where the user slides the data filter to specify a range, and the chart will show lines for the currencies showing the percentage change in value across that period. That means that whatever the range, the lines will begin at 0% and move either up or down, away from there.
My data set is as follows, with the nominal values on the left, and the % change from the earliest date (01/01/2014) on the right. See image below:
Currently, my graph plots the % changes (the bit in orange in the image above), which, when the date filter starts at the earliest date, looks like the image below:
BUT.... When I change the start date, all the graph does it display the preexisting % change data (as it would) and the lines are not an actual percentage change across the new date range, but rather a snapshot the overall date range % changes. See image below:
I realise exactly why this is happening, but what I want to do is use calculations and date parameters based only off the nominal currency values (the stuff in pink in the first image) so that, whatever the date range, the lines will begin at 0% and show only the % change for that period.
Sorry for the long-winded post, but I wanted to provide as much info as possible. I have also attached the dataset and the current Tableau workbook.
Thanks.
Henry
Hi Henry,
I took a different approach than Martin. I used Tableau's built in Table calculations to show % Difference from the start. You can access these by dragging SUM(Usd/Byr) to Measure Values. Then right-click, choose Quick Table Calculation, then choose Percent Difference. After doing that, you have to click Relative to... and then choose "First". This makes it so that your calculations are always done according to the first value in the view, regardless of timeframe.
Attached is my version. I also added in a calculated field WINDOW_MIN(MIN([Date])). It calculates the minimum date on the view, and returns that value. I did this so you can use it in the title on your dashboard so it always reflects your choice of dates.
Martin's solution works as well, it's just a matter of what you prefer.
Hope this helps!
--Ben