# Qlik Sense App Development

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

Tags (3)
1 Solution

Accepted Solutions
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

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

New Contributor III

## Re: current week vs previous week ?

Thanks sunny

Valued Contributor