Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
ananyaghosh
Creator III
Creator III

How to calculate previous week

Hi,

I need to show previous week's data from the attached QVD based on the current date, means current date's previous week will be calculated and data will have to be shown according to that week.

Please let me know how to achieve that.

Thanks,

Sandip

12 Replies
Anonymous
Not applicable

Hi,

When you say current date based on data, do you mean the max date ? because in your data you don't have 2017...

So If i understanfd you want the previous week of max date's data. In that case may be week(max(orderdate))-1

ananyaghosh
Creator III
Creator III
Author

hi,

your expression is wrong and it gives me no data.

Anil_Babu_Samineni

Finally, You want to do this in Script level. Here, Which date you meant to say - 27/12/2015 ??

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
ananyaghosh
Creator III
Creator III
Author

yes, based on the order date. So if I choose 27/12/2015, then it will show the sum(slaes vales) based on the previous week of the selected date.

So please suggest a way of how to do that.

Thanks,

Sandip

Anil_Babu_Samineni

May be try this in straight table with dim as [Order Date]

Sum({<[Order Date] = {'$(=Date(Max([Order Date])-7))'}>}Sales)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
el_aprendiz111
Specialist
Specialist

Hi,

in SCRIPT:

NUM(Week([Order Date]-7),'00')  AS _WEEK,

Not applicable

Hi Sandip,

Please see below and qvw attached. Any good?

qvw screenshot.GIF

Anonymous
Not applicable

Sorry i didn't really understand your needs

May be it will helps you

shamitshah
Partner - Creator
Partner - Creator

Hi Sandip,

Have a look at the attached. I have created some variables and included two text boxes.

By selecting any date from the list box will show the sales for that date in one text box. The other text box will show the sales for the other date (7 days prior).