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: 
gerrycastellino
Creator III
Creator III

question on alternate states/addmonths in Year over Year calc

having a problem with my syntax below.

My default state is where I have the most recent month selected - see image.

I'm trying to go back 12 months to  grab a value from a year ago from my default state.

I have the below expr linked to alternate state which is not working.

=sum({< %Snapshot_Date = {"$(=addmonths($::%Snapshot_Date,-12,1))"} >} Headcount

What am I missing ?

Thankx !

Gerry.

1 Solution

Accepted Solutions
sunny_talwar

QlikView is case sensitive and you date field is called date1 and not Date1 (see the upper case D vs lower case d)..

This worked

=Sum({<emptype={'PT'}, date1 = {"$(=Date(AddMonths(Only({$} date1), -12), 'MM/DD/YYYY'))"}>}sales)

whereas this didn't

=Sum({<emptype={'PT'}, Date1 = {"$(=Date(AddMonths(Only({$} Date1), -12), 'MM/DD/YYYY'))"}>}sales)

View solution in original post

20 Replies
Anil_Babu_Samineni

Why are you looking expression? Instead of that we have always one selected value right. You can go for Alternate state as mention

Please add me Anil_Babu_Samineni to interact faster when reply back. Speak low think High.

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
gerrycastellino
Creator III
Creator III
Author

Anil:

You are not understanding the problem.

I'm trying to reference a date in default state going back 12 months,  in another alternate state.

It's a syntax issue I'm facing.

Gerry.

Anil_Babu_Samineni

Oh, I apologizes for that, Can you share application to look

Please add me Anil_Babu_Samineni to interact faster when reply back. Speak low think High.

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
gerrycastellino
Creator III
Creator III
Author

Hi anil

see attached.

gerrycastellino
Creator III
Creator III
Author

change the date to 4/30/16,  4/30/17.

avinashelite

So your object where your referring to the above expression has an alternate state ? if yes then it will be seeking the selection to be in the alternate state mode so this is the syntax

Function({[state_identifier1] <field_name2= [state_identifier2]::field_name3>}field_name)


in your expression I could not see the state 2

sum({< %Snapshot_Date = {"$(=addmonths($::%Snapshot_Date,-12,1))"} >} Headcount)

Anil_Babu_Samineni

Like this?

Capture.PNG

Please add me Anil_Babu_Samineni to interact faster when reply back. Speak low think High.

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
gerrycastellino
Creator III
Creator III
Author

HI Anil:

my source state is the default state $.

I'm assigning this in text box which is my "to" state, isn't it implied ?

Anil_Babu_Samineni

Do you follow the same Which Avinash provide the syntax in between the Operator <AlterNateState{

Please add me Anil_Babu_Samineni to interact faster when reply back. Speak low think High.

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)