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: 
Not applicable

how to get one week,one month,one year and previous day values in script

Hi All,

Here I have Date Field and value field,With this I need to create straight table containg fields oneday change,change one week same day to today,and one month same day to today and one year same day to today,when ever user selects year and month sraight table need to show all these values of that particular month,

I use set analysis I fail to achive.I used all types of set analysis like direct set analysis, indirect set analysis and used variables.I mentioned all these expressions

it has no syntax errors but not working always

    =sum({<Stockdate={"$(vonedayago)"}>}Index_Value)

   =sum({<Stockdate={"$(voneweekago)"}>}Index_Value)

    =sum({<Stockdate={"$(vonemonthago)"}>}Index_Value)

    =sum({<Stockdate={"$(vsixmonthsago)"}>}Index_Value)

=sum({<Stockdate={"$(voneyearago)"}>}Index_Value)

Sum({<Year = {$(=Year(Date(Max(Stockdate-1))))},Month = {$(=Month(Date(Max(Stockdate-1))))},week = {$(=week(Date(Max(Stockdate))))},days = {$(=Day(Date(Max(Stockdate-1))))} >}Index_Value)

    =Sum({<Year = {$(=Max(Year))},Month = {$(=Month(Date(Max(Stockdate))))},days = {$(=Day(Date(Max(Stockdate-1))))} >}Index_Value)

   =Sum({$<Year = {$(=Max(Year))},Month = {$(=Month(Date(Max(Stockdate-7))))},days = {$(=Day(Date(Max(Stockdate-7))))} >}Index_Value)

    =Sum({<Year = {$(=Max(Year))},Month = {$(=Month(addmonths(Max(Stockdate),-1)))},days = {$(=Day(Date(addmonths(Max(Stockdate),-1))))}>}Index_Value)

    =Sum({<Year = {$(=Max(Year-1))},Month = {$(=Month(addmonths(Max(Stockdate),-6)))},days = {$(=Day(Date(addmonths(Max(Stockdate),-6))))}>}Index_Value)

   =Sum({<Year = {$(=Max(Year-1))},Month = {$(=Month(addmonths(Max(Stockdate),-12)))},days = {$(=Day(Date(addmonths(Max(Stockdate),-12))))}>}Index_Value)

I use FiledValue and Field index and peek functions inside script,using peek and orderby and resident temp i got previous day value but not getting one week,one month and one year before values  to solve this but not achive

Any suggestions or help appriciate ,Thanks in Advance

1 Reply
Not applicable
Author

Require not date field values,Require other fied(index) value on that dates I mean I have index value and date,I required lastdate index value,last week index value,last month index value and last year same day index value to caliculate % change with respect to time period