Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
andre_bento
Contributor II
Contributor II

Previous Period Calculation

Hello, I am trying to calculate the numeric value of a specific field (in this case TEU) for the previous period. I am using the following expression: 

=({<[DATE] = {">=$(=Date(min_date - date_diff-1))""<=$(=Date(min_date - 1))"}>} [TEU])

However my output is considering the full number of TEU's except the selected month, and what I wish is to only see the values for the previous period. Basically qlik is able to recognize the 2nd part of my expression "<=$(=Date(min_date - 1))" which defines the last day of the previous period but not the 1st part  ">=$(=Date(min_date - date_diff-1))". This is where I define the first day of the previous period using date_diff (this checks the range of days of my selected period).

Suggestions?

Labels (1)
3 Replies
Marco_Imperiale
Contributor III
Contributor III

Could be a syntax mistake? Try this way:

=({<[DATE] = {">=$(=Date(min_date - date_diff-1))<=$(=Date(min_date - 1))"}>} [TEU])

Chanty4u
MVP
MVP

Try this

=({<[DATE] = {">=$(=Date(min_date - date_diff - 1))<=$(=Date(min_date - 1))"}>} [TEU])

 

Marco_Imperiale
Contributor III
Contributor III

if it works for you, let me know and set my answer as "resolved" please.