Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
TTac
Contributor
Contributor

Previous month period

Hi all,

Could anyone help me with this issue below:

I wrote this expression for the last period in my dataset and it`s fine:

IF(Period_end_date=(max(TOTAL Period_end_date)),1)

TTac_0-1646071660019.png

But the issue is that I'm struggling with expression to write '1' for my previous period. 

So my question is how to write '1' ONLY for the previous month, last day period?

I was trying something like that but it's not working:

IF(Period_end_date=Monthend(AddMonths(max(TOTAL Period_end_date),-1)),1)

 

Labels (1)
1 Solution

Accepted Solutions
TTac
Contributor
Contributor
Author

It didn't work. But still thanks for helping!

I have already managed it with this expression:

IF([Period_end_date.autoCalendar.YearMonth]=(AddMonths(max(TOTAL[Period_end_date.autoCalendar.YearMonth]),-1)),1)

View solution in original post

2 Replies
Digvijay_Singh

may be try set expression, hopefully your date field is not a timestamp field, sometimes it creates problem in comparison if the date field got decimal part.

Max({<Period_end_date = {"=$(=Monthend(Max(Period_end_date),-1))">}>}Period_end_date)

if it doesn't work, pl share some sample data, date comparison in set analysis is tricky.

 

TTac
Contributor
Contributor
Author

It didn't work. But still thanks for helping!

I have already managed it with this expression:

IF([Period_end_date.autoCalendar.YearMonth]=(AddMonths(max(TOTAL[Period_end_date.autoCalendar.YearMonth]),-1)),1)