6 Replies Latest reply on Jan 6, 2019 6:15 PM by Welly Pratama

# Last Week Calculation

Hi Guys,

I have a problem here, i want to make a last week calculation based on the week that user selected i have try many ways to get the value from last week but nothing works so far. anyone can help me?

so the point is, when the user click at week 3 there will be 2 calculation showing value from the week that user selected and previous week ( last week ) based on that user choose.

Also the workbook attach

Thank You.

• ###### 1. Re: Last Week Calculation

Hi, Welly

There is no attachment. and also, I will suggest to use parameter for last week pick up which will be easier to achieve.

ZZ

• ###### 2. Re: Last Week Calculation

good morning Welly

Filters are used to remove (filter out) data from the table that underlays the viz - when yo apply a filter for "This Week"  the data for last week is no longer there

you can use a parameter - it will look like a filter to the user - and then use a dateadd formula to look back one week

Jim

If this posts assists in resolving the question, please mark it helpful or as the 'correct answer' if it resolves the question. This will help other users find the same answer/resolution.  Thank you.

• ###### 3. Re: Last Week Calculation

hi Zhouyi Zhang,

sorry for the attachment, here's the attachment i hope you can help me to solve this problem.

• ###### 4. Re: Last Week Calculation

Hi jim,

can syou show me using the workbook\? i attach the workbook with sample data because i'm confused with the parameter last week, when i select week 3 the data will only showing data from week 3 and cannot showing the other week

Thank You.

• ###### 5. Re: Last Week Calculation

see the attached your problem statement does not clearly define the issue - you are looking for the week shown and the previous week that has data - in the case of store b those are weeks 1 and 3

this is the parameter the users uses to input data

this will limit the data in the view to dates less than or equal to the date (week of) in the parameter

I used rank to find the previous value - you could also just use a lookup()

and then the filter

Jim

Tableau has excellent training videos at Tableau Training: View Training Courses   that will help you understand filtering and parameters

If this posts assists in resolving the question, please mark it helpful or as the 'correct answer' if it resolves the question. This will help other users find the same answer/resolution.  Thank you.

1 of 1 people found this helpful
• ###### 6. Re: Last Week Calculation

ah i know right now using it as parameter for user choose the week and then we can filter which week and value we want to show to user based on the parameter.

Thank you Jim Dehner