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

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
n1ef5ng1
Creator
Creator

Last year current month

 

I have a problem displaying out the last month. When a user select April 2013, I will have two expression that show April 2013 and April 2012. It will take the current month.

This is my expression for both of them

Label : Only(Month) and Only(Year)-1

Sum(

  {$<Line_Code={'ADV','MAL','AMT'},Derived_Status={'IMPT','EXPT'},Derived_Container_Class_Name={'LADEN'},Month_Id={"<= $(=Max(Month_Id))"},Year ={$(=Max(Year)-1)},Month=, Month_Year = >}TEU

 

=

ONLY(Month) & ' ' & ONLY(Year

)

sum({<Line_Code={'ADV','MAL','AMT'},Derived_Status={'IMPT','EXPT'},Derived_Container_Class_Name={'LADEN'},Month_Id={$(=Max(Month_Id))},Year = ,Month=, Month_Year = >}  TEU)

For Only(Month) and Only(Year), current year. i managed to get the value correctly,

for Only(Month) and Only(Year)-1, I get a YTD of Jan - Apr 2012 instead. I am actuallly looking for Apr 12 current month instead.

why is this so, thanks

Labels (1)
16 Replies
tresB
Champion III
Champion III

Remove '<' from you first expression.

n1ef5ng1 wrote:

 

Sum(

  {$<Line_Code={'ADV','MAL','AMT'},Derived_Status={'IMPT','EXPT'},Derived_Container_Class_Name={'LADEN'},Month_Id={"   <   = $(=Max(Month_Id))"},Year ={$(=Max(Year)-1)},Month=, Month_Year = >}TEU

n1ef5ng1
Creator
Creator
Author

what do u mean?

tresB
Champion III
Champion III

there is a '<' symbol before the smiling face(i inserted), remove that and try.

n1ef5ng1
Creator
Creator
Author

doesn work though, my figure all became 0 after removing >

tresB
Champion III
Champion III

Sum(
  {$<Line_Code={'ADV','MAL','AMT'},Derived_Status={'IMPT','EXPT'},Derived_Container_Class_Name={'LADEN'},Month_Id={" $(=Max(Month_Id))"},Year ={$(=Max(Year)-1)},Month=, Month_Year = >}TEU
 
Try copy paste the above
Update: sorry, missed the last parenthesis ')', please add that and try.
n1ef5ng1
Creator
Creator
Author

still zero value, i not sure why. this coding should work too.

why is it my previous coding will give me a ytd

tresB
Champion III
Champion III

if you put Month_Id= {"<= $(=Max(Month_Id))"} ..... that means month would considred if that is LESS THAN or EQUAL TO, hence Jan to Apr all months. that is why if you remove the '<=' part it should give you the desired result.

hope this helps.

n1ef5ng1
Creator
Creator
Author

okay learnt something new thanks.

really clueless on why is the value not showing

tresB
Champion III
Champion III

Can you share a sample app?