Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
mhmmd_srf
Creator II
Creator II

Need to calculate prior week value

Hi All,

Greeting of the day.

I need your help on the below requirement.

User will select a Date. Lets say it is 10th May 2016. The graph will show the data by hour.

So it will show data for 00.00 to 23.00 (24 hour).--- this is my X axis.

in Y axis I need to show 2lines

a> it will show the value for current selection.

b> it will calculate last 4 Tuesday's data. As 10th May is Tuesday.

So I am creating below variables:

SET v_DATE = GetFieldSelections([M_DATE]);

Set v_DATE7 = Date(Date#($(v_DATE),'MM/DD/YYYY') - 7);

Set v_DATE14 = Date(Date#($(v_DATE),'MM/DD/YYYY') - 14);

Set v_DATE21 = Date(Date#($(v_DATE),'MM/DD/YYYY') - 21);

Set v_DATE28 = Date(Date#($(v_DATE),'MM/DD/YYYY') - 28);

and I am trying to use the below expression :

For Current Date selection: Sum({$<'$(=v_DATE)'>}DLV_LINE_CNT) -- this is working fine.

Similarly, Sum({$<'$(=v_DATE7)'>}DLV_LINE_CNT) or Sum({$<'$(=v_DATE14)'>}DLV_LINE_CNT) is not working.

I thought to do in this way:

Sum({$<'$(=v_DATE7)'>}DLV_LINE_CNT) + Sum({$<'$(=v_DATE14)'>}DLV_LINE_CNT) + Sum({$<'$(=v_DATE21)'>}DLV_LINE_CNT) + Sum({$<'$(=v_DATE28)'>}DLV_LINE_CNT)

Could anyone suggest on this?

Thanks in advance.

13 Replies
mhmmd_srf
Creator II
Creator II
Author

Hi Phani,

I am attaching the qvf file. Please have a look and suggest me.

Thanks,

Sarif

phaneendra_kunc
Partner - Specialist III
Partner - Specialist III

Attached is the updated.

I have created two new variables (v_DATE_NEW, v_DATE7_NEW) and updated the expressions. !

mhmmd_srf
Creator II
Creator II
Author

Thanks a lot Phani... I will try the same coding in client application...and will let you know..

Thanks for all your time...

Thanks,

Sarif

mhmmd_srf
Creator II
Creator II
Author

Hi Phani,

It is working fine now..

Thanks a lot for your help..

Thanks,
Sarif