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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
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

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

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
MVP
MVP

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 !!!