
1. Re: Calculating percentage difference compared to previous week number
Shinichiro Murakami Nov 11, 2015 6:02 PM (in response to brian.kim.0)Brian,
I have not quite understood the question, but try something.
File attached created by version 9.0.
Thanks,
Shin
Change to week bucket.
Then change the start day of week. ==> follow the link.
http://kb.tableau.com/articles/howto/mondayfirstdayofweek
absolute Date:

datedate.twbx 7.6 KB


2. Re: Calculating percentage difference compared to previous week number
brian.kim.0 Nov 12, 2015 10:23 AM (in response to Shinichiro Murakami)Awesome, now I know what I was doing wrong  it was trying to enforce the week rule at the table calculation level as well.
So if I want to display just this week's percentage difference compared to last week's number, how do I do that? I tried filtering the date to show just this week, but because the filter doesn't show the previous week's # of records, it isn't able to calculate the percentage difference. Any idea how to show just this week's percentage difference?

3. Re: Calculating percentage difference compared to previous week number
Shinichiro Murakami Nov 13, 2015 6:05 AM (in response to brian.kim.0)Little bit tough in that case.
However, two ways I can propose.
Anyways, you need to create parameter added from [date].
Then calc field like below.
[Show date]
if datepart('week',[Parameter 1])=datepart('week',[Date])
or datepart('week',([Parameter 1]7))=datepart('week',[Date])
then [Date] end
Put [Show date] instead of [date] then exclude null.
Your table calc still works in this case. (==> see one way tab)
Another way is also create three more calc field
[Parameter week count]
if datepart('week',[Parameter 1])=datepart('week',[Date]) then 1 else 0 END
[Parameter Previous week count]
if datepart('week',([Parameter 1]7))=datepart('week',[Date]) then 1 else 0 END
[Current week count / Previous week count]
sum([Parameter week count])/sum([Parameter Previous week count])
Then you can show in one line. (==> Another way tab)
Thanks,
Shin

datedate rep.twbx 39.1 KB


4. Re: Calculating percentage difference compared to previous week number
Rody Zakovich Nov 13, 2015 6:20 AM (in response to brian.kim.0)Hey Brian,
For your second question you could do
IF LAST() == 0
THEN SUM([Value]) / LOOKUP(SUM([Value]), 1)
END
And set that to compute using your Date.
LAST() == 0 equates to the most recent Date in your Viz, because the most recent Date will be the LAST Partition.
So on the most recent date, Take the SUM of that Value and Divide it be the SUM of the Value from the previous partition (Previous Week). Since we don;t add an ELSE statement, all partitions that aren't the LAST one will equate to NULL, aka, no value will show.
Regards,
Rody

5. Re: Calculating percentage difference compared to previous week number
brian.kim.0 Nov 15, 2015 8:44 PM (in response to Rody Zakovich)Hey Rody, thanks for the suggestion. Is there a way to use that calculation as a filter? I originally followed this post (Re: Can I calculate a shape as an 'up' or 'down' arrow depending on a quick table calculation?), but I think I got it with your tip.
Basically, I put your calculation as the filter. But since this week's value calculates to 7, the filter is set to that number. Will this automatically update next week? How do I filter out everything except for NULL? Or will the current filter work in the future as well?

6. Re: Calculating percentage difference compared to previous week number
brian.kim.0 Nov 15, 2015 10:21 PM (in response to brian.kim.0)Nevermind, found the tab within filters to do it

7. Re: Calculating percentage difference compared to previous week number
Rody Zakovich Nov 17, 2015 11:26 AM (in response to brian.kim.0)Hey Brian,
Sorry for the late response.
Did you get your issue solved?
If so can you please mark a response a correct, or share your solution and mark that as correct.
This will help other members who are searching for answers for similar questions.
Regards,
Rody