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

Max Period - 1 Not Working

I have periods in my data set formatted as 11/1/2017

The max period calculation is working

PERIOD = {"$(=Max(PERIOD))"}

But the previous period calculation is not

PERIOD = {"$(=Max(PERIOD)-1)"}

Any pointers here?

Thank you,

- dave

1 Solution

Accepted Solutions
sunny_talwar

So, essentially you are going back a month? May be this

PERIOD = {"$(=AddMonths(Max(PERIOD), -1))"}

View solution in original post

5 Replies
YoussefBelloum
Champion
Champion

Hi,

what do you want exatly when you say -1 ? day -1, month -1, year -1 ?

Anonymous
Not applicable
Author

So the periods are set up in a monthly fashion ... i.e

1/1/2017

2/1/2017

3/1/2017

etc ...

I want to sum({< PERIOD = {"$(=Max(PERIOD)-1)"}>} AMT)) ... so if the max period is 3/1/2017 I want to return AMT for 2/1/2017

sunny_talwar

So, essentially you are going back a month? May be this

PERIOD = {"$(=AddMonths(Max(PERIOD), -1))"}

vinieme12
Champion III
Champion III

when you do math operation on a date value the resultant will be an Integer value, so there is a data type mismatch

to avoid that you must specify your date format for the field PERIOD

example

$(=DATE(Max(PERIOD)-1)))  or  $(=DATE(Max(PERIOD)-1,'DD/M/YYYY'))

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Anonymous
Not applicable
Author

Works perfect thank you !!!