4 Replies Latest reply: Mar 28, 2016 2:30 PM by Sangram Reddy

# 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

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

• ###### Re: current week vs previous week ?

Thanks sunny

• ###### Re: current week vs previous week ?

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

• ###### Re: current week vs previous week ?

Hi Gaurav,

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

Thanks,

Sangram