Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
materi
Contributor III
Contributor III

Date problem

I want to have a KPI with values from the previous month in an app, and I don't know how to do that easily. I want to use an expression that looks something like:

Sum({$<Period={Magic}>}Size)

...such that the size for the previous month is shown in the KPI. What code can I use in the Magic section of that expression? The autoCalendar expressions didn't do anything since they just pick up the actual time from the computer and not the stored time data in the database.

3 Replies
Rick_T
Contributor III
Contributor III

Hi Materi, 

Can you post a sample app here? 

I use the following expression in the load editor to make a variable: 

Let vLastMonth = date(AddMonths(today(), -1), 'MM'); 

This returns the number of last month so in my case it says '07' right now. So in your case the set expression will be something like this: Sum({$<Month={$(vLastMonth)}>}Size)

Maybe this helps. 

 

sincerely, 

Rick

materi
Contributor III
Contributor III
Author

Thanks for your response, Rick! But my problem is that I need to take the dates from my server, so I can't use the real time and thus not the built-in Date expressions in Qlik.

Rick_T
Contributor III
Contributor III

Can you post the date format that you import from your server?