Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi ,
I want to calculate sales for last weeks excluding last 28 days excluding saturday sunday.
Can any one help me
Regards
Manu
Hi,
can you elaborate more with an example ?
where do you want to use this expression ?
do you want to use a set analysis for this ?
can you share a screenshot of your data model ?
The simplest way can
WeekDay(DateField) as WeekDay,
Week(DateField) as Week
And then Set analysis should
Sum({<Week = {">=$(=Max(Week)-4)<=$(=Max(Week))"}, WeekDay -= {'Sat','Sun'}>} Sales)
This will give you the last 28 days:
sum({<Date={"$(=max(Date)-28)"}>} Sales)
Then you need to find a way to exclude weekends. This is anything where the WeekDay function returns <5 (this runs from 0=Monday to 6= Sunday)
so you could add this to your set analysis: WeekDay(YourDateField)*1<5
(the *1 is to force the result to be numeric)