Skip to main content
Announcements
Qlik Community Office Hours - Bring your Ideation questions- May 15th, 11 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
andre_bento
Contributor II
Contributor II

Calculating Previous period

I am trying to calculate the number of TEU's for the previous period. So if i select the month of March I want to see the number of TEU's for February. I created two variables min_date which gives me the first day of my selected range, and date_diff which gives me the number of days in my range, so if I select the month of March my min_date would be 01/03/2024 and my date_diff would be 31. I tried using the following expression to calculate my previous period: =({<[DATE.autoCalendar.Date]={">=$(=$(min_date) -$(date_diff)-1)))<=$(=$(min_date)-1))"}>} [TEU])
However I am getting the number of TEU's for the month of March and not for February. 

Labels (1)
3 Replies
Clement15
Creator III
Creator III

Hello, you can use this : 

{<month={"$(=month(AddMonths(max(Date),-1)))"}>}

 

You can use MonthName instead of Month depending on what you want

andre_bento
Contributor II
Contributor II
Author

Hello,

 

Screenshot 2024-04-04 at 14.51.34.png

That returns an error in expression.

Clement15
Creator III
Creator III

The formula I provided to you is just the set analysis, you must adapt it to your measure. Additionally, you need to change the field names to match your data