Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Reg: Display current week and previous week

Hi All,

I have bar chart, for that i need to display the current week data as one bar and the previous week data as another bar by default. when we select a date,it should consider the week of that date as current week and the previous week of that as previous. how can i achieve the same.

Thanks in advance

1 Solution

Accepted Solutions
Not applicable
Author

hii,

i have tried this.hope its workin nw..

=sum({<Week={$(=Max(Week))},Cust_Week=,@_Date=,Year=,Day=,@_Month=,I_PLANT={'Autofit Daruhera Plant'}>} I_CURRENT_REQ_QTY)

= sum({<I_PLANT={'Autofit Daruhera Plant'},Week={$(=Max(Week-1))},Cust_Week=,@_Date=,Year=,Day=,@_Month=>} I_CURRENT_REQ_QTY)

View solution in original post

17 Replies
sujeetsingh
Master III
Master III

Reena

Just have look to this thread

http://community.qlik.com/thread/72802

sujeetsingh
Master III
Master III

Even this too is helpful

http://community.qlik.com/thread/70549

its_anandrjs

Write

Dimension :- week

Expression Current Week:- =sum({<Week={$(=(Week))>} Sales Val)

Expression Previous Week:- =sum({<Week={$(=(Week-1))>} Sales Val)

Regards

Not applicable
Author

Hi Reena,

  Derive week field from your date and follow Anand method

nizamsha
Specialist II
Specialist II

sum(Date={"$(=Max(MyDate))"}) for Current Date say its Sunday

sum({$<Date={"$(=only(MyDate)-7)"}>}sales) Previous Date Last Sunday

Not applicable
Author

Hi,

First generate Week field from your table script by using this

Week(DateField) as Week

and Follow anand's post

Not applicable
Author

Hi,

but i need to take the dimension as Date, when i select the Date the corresponding week information and the previous week information should display.

i tried the above ,but its not working .dont kno why..

Thanks...

its_anandrjs

Update i think it will give you correct out put for Date field

Take a Date field as dimension and in expression write

For current week =sum({< Week = {'$(=Max(week(Date)))'}>} Sales)

For Previous week =sum({< Week = {'$(=Max(week(Date))-1)'}>} Sales)

Hope this helps

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this

=Sum({<Week=, Year=, Month=, Quarter=, Date={'>=$(=WeekStart(Max(Date), -1))<=$(=Date(Max(Date)))'}>} MeasureName)

Regards,

Jagan.