Can you please upload/attach a Tableau Packaged Workbook so we can get a better look at your data structure?
I'd suggest you should be able to achieve this by creating a calculated field like;
The problem is that you're effectively trying to create a new dimension member which would be 'LY Var' in the Period dimension.
It would be much easier to achieve this if your data structure was structured like;
or even better
Metric, Period, Value
Would this be possible?
Metric Period Value
Sales LY 3.5
Spend LY 4
I was hoping there is other workaround besides data manipulation. If not, I will probably resort to data transfomration...
Here is the sample workbook in TD 9.2. I would like to have a third column LY VAR that is calculated as (CY-LY)/LY. For example, LY Var for Sales will be (25-15)/15 = 66.7%
1 of 1 people found this helpful
The best structure would be Metric, Period, Value as per your example.
Connect to your data, select your three metric columns, right click and select pivot.
Now in your report create three calculated fields;
CY = sum(if [Period]='CY' then [Pivot Field Values] end)
LY = sum(if [Period]='LY' then [Pivot Field Values] end)
LYChange = ([CY]-[LY])/[LY]