Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
gauravgg
Partner - Creator
Partner - Creator

current week vs previous week ?

hi,

I want to show current week and previous week bar in bar chart

I wrote the following expression

Current Week : sum({$<Date={'>=$(=Date(WeekStart(Max(Date)),'DD/MM/YYYY'))<=$(=Date(WeekEnd(Max(Date)),'DD/MM/YYYY'))'}>}[Order Value])

Previous Week: sum({$<Date={'>=$(=Date(WeekStart(Max(Date),-1),'DD/MM/YYYY'))<=$(=Date(WeekEnd(Max(Date),-1),'DD/MM/YYYY'))'}>}[Order Value])

but the weekstart() function which i have used starts the week from Sunday to Saturday

I want the week to start from Monday to Sunday

So the expression which i have wrote gives me the wrong output

can anyone help me

thanks in advance

1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

Try these:

Current Week : Sum({$<Date={'>=$(=Date(WeekStart(Max(Date), 0, 0),'DD/MM/YYYY'))<=$(=Date(WeekEnd(Max(Date), 0, 0),'DD/MM/YYYY'))'}>}[Order Value])

Previous Week: Sum({$<Date={'>=$(=Date(WeekStart(Max(Date),-1, 0),'DD/MM/YYYY'))<=$(=Date(WeekEnd(Max(Date),-1, 0),'DD/MM/YYYY'))'}>}[Order Value])

View solution in original post

5 Replies
sunny_talwar
MVP
MVP

Try these:

Current Week : Sum({$<Date={'>=$(=Date(WeekStart(Max(Date), 0, 0),'DD/MM/YYYY'))<=$(=Date(WeekEnd(Max(Date), 0, 0),'DD/MM/YYYY'))'}>}[Order Value])

Previous Week: Sum({$<Date={'>=$(=Date(WeekStart(Max(Date),-1, 0),'DD/MM/YYYY'))<=$(=Date(WeekEnd(Max(Date),-1, 0),'DD/MM/YYYY'))'}>}[Order Value])

gauravgg
Partner - Creator
Partner - Creator
Author

Thanks sunny

t_chetirbok
Creator III
Creator III

If Sunny answer is correct, please, check it as "Correct Answer"

reddy-s
Master II
Master II

Hi Gaurav,

Make use of this: inweek(), inweektodate()

Thanks,

Sangram

raviteja475
Contributor
Contributor

i didn't get the answer using inweek() ,inweektodate()