Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

gauravgg
New Contributor III

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
MVP
MVP

Re: current week vs previous week ?

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])

4 Replies
MVP
MVP

Re: current week vs previous week ?

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
New Contributor III

Re: current week vs previous week ?

Thanks sunny

t_chetirbok
Valued Contributor

Re: current week vs previous week ?

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

reddys310
Honored Contributor II

Re: current week vs previous week ?

Hi Gaurav,

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

Thanks,

Sangram

Community Browser