Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Join this live chat April 6, 10AM EST - QlikView to Qlik Sense REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
dmelillo
Creator III
Creator III

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 ?

dmelillo
Creator III
Creator III
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))"}

View solution in original post

vinieme12
Champion II
Champion II

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'))

dmelillo
Creator III
Creator III
Author

Works perfect thank you !!!