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: 
n1ef5ng1
Creator
Creator

Year to Date -1 not working

Hi gurus,

I have a table with expression

Year to Date this year

and

Year to Date last year

i.e

Jan-Mar 13

and

Jan-Mar 12

I need to find the percentage of the shares that a particular operator owns.

this is my code for Jan-Mar 13

 

sum

({<Line_Code={'ATT'},Derived_Status={'IMPT','EXPT'},Derived_Container_Class_Name={'LADEN'},Month_Id = {"<= $(=Max(Month_Id))"}, Year = {$(=Max(Year))

and this is my code for Jan - Mar 12

 

sum

({<Line_Code={'ATT'},Derived_Status={'IMPT','EXPT'},Derived_Container_Class_Name={'LADEN'},Month_Id={$(=Max(Month_Id)-12)\

I managed to get the value for YTD this year but a null value on YTD last year.

is there anything wrong with the code?

3 Replies
tresesco
MVP
MVP

What are the possible values in your field - Month_Id? Is it like 201201, 201202,....201301 ?

somenathroy
Creator III
Creator III

Hi,

If your Month_Id contains values like 1, 2, ...,11,12 Then the below expression should work:

sum

({<Line_Code={'ATT'},Derived_Status={'IMPT','EXPT'},Derived_Container_Class_Name={'LADEN'},Month_Id = {"<= $(=Max({<Year={'$(=Max(Year))'}>}Month_Id))"}, Year = {$(=Max(Year))

Regards,

Som

narender123
Specialist
Specialist

for last year try this.

({<Year = {$(=Max(Year)-1)},,Month={"<=$(=num(Month(Today())))"},Line_Code={'ATT'},Derived_Status={'IMPT','EXPT'},Derived_Container_Class_Name={'LADEN'}>}your field}