Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
gr_eldred
Creator II
Creator II

Current week vs previous week

Good afternoon, I am looking for a way to perform an operation of the current week / previous week of the same year

But I only get 0s out.

I leave an image of the structure of my table

semanaant.png

I need to create an indicator that divides the sales of the week / week-1 of the same year.

Example:  w2/w1,

                     w3/w2,

                    w4/w3.  ......

etc..

Someone can help me please.

8 Replies
sunny_talwar

One way would be to use

The As-Of Table

Anonymous
Not applicable

two ways 1) Create the weeks in Master Calendar and expression to achieve this.

2) create variable and expression.

i'll cover #2 because i don't know how your calendar is structured.

vWeekStart "= WeekStart(today(),0,0)" //var today's current week start date(Monday)

vWeekEnd  "= WeekEnd(today(),0,0)" //var today's current week end date (Sunday)

vPrevWeekStart "= WeekStart(today(),-1,0)" //var last week's date on Monday

vPrevWeekEnd  "= WeekEnd(today(),-1,0)" //var last week's date on Sunday

expression:

=sum({<date={'>=$(vWeekStart)<=$(vWeekEnd)'}>}amount) //sum current week amount

=sum({<date={'>=$(vPrevWeekStart)<=$(vPrevWeekEnd)'}>}amount) //sum previous week amount

current / previous week.

=(sum({<date={'>=$(vWeekStart)<=$(vWeekEnd)'}>}amount))

/

(sum({<date={'>=$(vPrevWeekStart)<=$(vPrevWeekEnd)'}>}amount)) //current week / previous week

hope this was what you're looking for.

Bon.

qliksus
Specialist II
Specialist II

Considering the view you have and you just want to take the previous week something like the below

Sum(Sales)/Before( Sum(Sales))

gr_eldred
Creator II
Creator II
Author

Hello Susant, try with before but only show me "-". Need a division from previous week / week (week / week-1)wow1.png

gr_eldred
Creator II
Creator II
Author

hi,

Weeks I have numerics although I concatene the "w" I need week / week-1 wow1.png

qliksus
Specialist II
Specialist II

Can you post a sample file or the expression you are using ?

raviteja475
Contributor
Contributor

its not working i used count instead of sum and and instead of amount i used no.of.sales

raviteja475
Contributor
Contributor

can you please help me how to find the current week and previous week count of sales