
1. Re: Help with calculation not returning correct percentage difference. (WORKBOOK ATTACHED)
Jim Dehner Mar 8, 2017 11:55 AM (in response to sam.hong.0)1 of 1 people found this helpfulHi
I think the problem was with the change calculation  ZN((SUM([Selected Year Events])  SUM([Previous Year Events])) / SUM([Previous Year Events]))
Note I changed the denominator to previous year events
here are the results
Let me know if this helped
Jim

2. Re: Help with calculation not returning correct percentage difference. (WORKBOOK ATTACHED)
sam.hong.0 Mar 8, 2017 1:15 PM (in response to Jim Dehner)Ha! Wow, I definitely did not pay attention to detail.
You are correct, my calculation was wrong!
Thank you!
Sam

3. Re: Help with calculation not returning correct percentage difference. (WORKBOOK ATTACHED)
Jim Dehner Mar 8, 2017 1:17 PM (in response to sam.hong.0)Glad to help.
Jim

4. Re: Help with calculation not returning correct percentage difference. (WORKBOOK ATTACHED)
sam.hong.0 Mar 8, 2017 1:19 PM (in response to Jim Dehner)Wait, I spoke to soon.
Notice the first row, how come the calculation is still 0% even though it increased by 1 event between the years?
Sam

5. Re: Help with calculation not returning correct percentage difference. (WORKBOOK ATTACHED)
sam.hong.0 Mar 8, 2017 1:26 PM (in response to sam.hong.0)Here is the workbook with calculation for your reference.
Would you be able to take a look?
Thanks!
Sam

Tableau Data  Crosstab TC.twbx 138.8 KB


6. Re: Help with calculation not returning correct percentage difference. (WORKBOOK ATTACHED)
Jim Dehner Mar 8, 2017 1:27 PM (in response to sam.hong.0)We needed the ) check  see this formula
Jim
If sum([Selected Year Events])>0 and sum([Previous Year Events]) = 0 then 1
elseif sum([Selected Year Events])=0 and sum([Previous Year Events]) = 0 then 0
else ZN((SUM([Selected Year Events])  SUM([Previous Year Events])) / SUM([Previous Year Events]))End

7. Re: Help with calculation not returning correct percentage difference. (WORKBOOK ATTACHED)
Glenn Kuly Mar 8, 2017 1:29 PM (in response to sam.hong.0)Hi Sam, since it's not possible to divide by zero, percentage change is tricky if that's your starting point.
You could adjust your calculation to show 'N/A' in these cases, or do something else along these lines.
 Glenn

8. Re: Help with calculation not returning correct percentage difference. (WORKBOOK ATTACHED)
Jim Dehner Mar 8, 2017 1:31 PM (in response to sam.hong.0)Sam I attached the workbook and also modified the formula for nulls add a ZN function on all the sums