Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
ishanbansal1204
Contributor III
Contributor III

Calculating previous week value

Hi All,

I have a weekend date as my filter option. As we follow different calendar so we have a different weekend dates.

Weekend date is the filter option.

I am calculating week on week where current week value is sum(sales)

the previous week formula that i have written is

SUM({<WEEKEND_DATE = {'$(=MAX(WEEKEND_DATE-7))'}>} sales)

but after many try and attempts of doing this i am getting the value as 0 always. Please suggest.

Note : Weekend date is difference of 7 days

18 Replies
HirisH_V7
Master
Master

Hi,

Try this,

using your max(Date) and modify your'e date format,

Sum({$<Date={">=$(=Date(WeekStart(Max(Date),-1, 0),'DD-MM-YYYY'))<=$(=Date(WeekEnd(Max(Date),-1, 0),'DD-MM-YYYY'))"}>}Sales)

HTH,

Hirish

HirisH
“Aspire to Inspire before we Expire!”
vinieme12
Champion III
Champion III

SUM({<WEEKEND_DATE = {"$(=DATE(MAX(WEEKEND_DATE-7),'YourDateFormatforWeekendDate')"}>} sales)

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
ishanbansal1204
Contributor III
Contributor III
Author

Hi Vineeth,

No Luck

Its still Null.

ishanbansal1204
Contributor III
Contributor III
Author

Hi Hirish,

I already have week start date with me.. Just want to know the previous week value.

HirisH_V7
Master
Master

Hi,

Check this

Sum({$<WEEKEND_DATE={"$(=Weekend(Max(WEEKEND_DATE),-1))"}>}sales)

If it doesn't work means, There may be no data for the previous week  or some date format issue may persist with it.

Else,please post some sample data.For further assistance.

HTH,

-Hirish

HirisH
“Aspire to Inspire before we Expire!”
pathiqvd
Creator III
Creator III

Hi,

   Do like this i think you will get.

First create on variable like

vTT=date(date(max(DT1),'DD/MM/YYYY')-7,'DD/MM/YYYY')  --> variable overview


after write below expr

=sum({<DT1={"$(vTT)"}>}Marks)

ishanbansal1204
Contributor III
Contributor III
Author

Hi Lakshmipathi,

Its still the same. Its displaying as 0. some where i feel that there is a problem with the date that we are using.

pathiqvd
Creator III
Creator III

Hi,


           It is working my side. Post your wkdate field values format.

ishanbansal1204
Contributor III
Contributor III
Author

my weekend date format in the oracle table is like "07-JAN-16"

When I am using that in Qlik sense - Filter Pane, I am converting that into

DATE((WEEKEND_DATE),'DD-MM-YYYY')

Now in the filter pane, I can see the values as " 15-12-2016"