Qlik Community

Ask a Question

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Qlik Highlights 2020 Giveaway! Watch, reply and have a chance to win a $200 Amazon Gift Card! Watch Video
cancel
Showing results for 
Search instead for 
Did you mean: 
Creator
Creator

previous month filter date

Hello everyone,

I need to set an expression like this:

One is: if the user filter from aug 21º to sep 10º,

the other expresison needs to have the result of the same days but from the last month: jul 21º to aug 10º.

How could I do that?

e.g.

Diesel consumption:

from aug 21º to sep 10º = 21,2

set expression: jul 21º to aug 10º = 19,6

Tks

1 Solution

Accepted Solutions
Specialist
Specialist

Hello, Samuel!

In set expression you can use Addmonths() function with Max() or Min() for indicating a range of output dates.

prev_mnt_selection.png

View solution in original post

4 Replies
Specialist
Specialist

Hello, Samuel!

In set expression you can use Addmonths() function with Max() or Min() for indicating a range of output dates.

prev_mnt_selection.png

View solution in original post

Something along this pattern:

Sum{<Date = {">=$(vMinDate) <=$(vMaxDate)"}>} Amount)

Sum{<Date = {">=$(=AddMonths(vMinDate, -1)) <=$(=AddMonths(vMaxDate, -1))"}, Month, Year>} Amount)


Assumes that the min and max are defined in the correct date format, that the fact table date field is called Date. I have also added overrides so that the date selection does not interfere with the second expression. If this does not work you will need more information to give more specific help.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Creator
Creator

Got it with this:

S_Date={'>=$(=addmonths(min(S_Date),-1))<=$(=addmonths(max(S_Date),-1))'}

Tks a lot,.

Creator
Creator

Tks for attention Jonathan.

Got it worked.

Gonna create variables to be faster.