Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
sjhussain
Partner - Creator II
Partner - Creator II

Current Date - Previous Date on same Line Chart

Dear All,

Hope everyone is doing well

We have a requirement to show Current Week and Previous week on the Same line chart.  I have built a master calendar. Please see the attached image

For e.g Current Date = Jan 17, 2015

Our week - Sunday to Saturday

Current Week = Jan 11 - Jan 17

Previous Week = Jan 4 - Jan 10

We need to show the Current Week and Previous Week on the same chart

Also how can we do the same for

* Current Day - Previous Day

* Current Month - Previous Month

Thanks

ThanksNote_20150117_125024_01.jpg

1 Reply
gartigas
Contributor II
Contributor II

Hi Syed;

I used the following method:

I give you the example for "Present Month" - "Last Month" - "Before Last Month":

First step:  Variables Definition

vPresent_Month= Month (Today())

vLast_Month= Month(AddMonths(Today(),-1))

vBeforeLast_Month=Month(AddMonths(Today(),-2))

Second step: Establish the expressions (in my case i count Activated SIM's for the 3 monthes)

a) Expresion for Present Month:

=Count ({$<ActivationMonth={$(vPresent_Month)}>}DISTINCT SIM)

b) Expresion for Last Month:

=Count ({$<ActivationMonth={$(vLast_Month)}>}DISTINCT SIM)

c) Expresion for Month "before the Last"

=Count ({$<ActivationMonth={$(vBeforeLast_Month)}>}DISTINCT SIM)

This expressions can be used in ein Simple Table or in a chart...

Dimension

The dimension... in my case are geographical regions..... (State - City - County)

You can use for example: ProductID.... SalesRep... etc...

In the Load Script i use:

Month (Activation_Date) as ActivationMonth,

++++++++++++++++++++++++++++++++++++++++++++++++++

For Day o Week... is easier... because you can use the Date or Week Number

I hope that help you

Regards. gustavo