Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

month and previous month?

i have month field and sales

i want comapre in single chart for current month sales and previous month sales ?

5 Replies
JonnyPoole
Former Employee
Former Employee

Can you tell me the format of you the data values in your month field ?  Are they dates ? Month Numbers (1-12) ? Month names (Jan-Dec) ?  That is the key piece to providing an expression that may work.

erjohnso
Creator
Creator

Set analysis using max month and max month -1. As JP stated above, would need the format before sharing any code. You might need to create a date convert crosswalk table for the calc as well.

Not applicable
Author

Hi,

here we need to write the set analysis,we can dynamically and static also.

for dynamic we can use several ways like directly give month or create a variable and place it in set analysis syntax.

Anonymous
Not applicable
Author

month numbers

JonnyPoole
Former Employee
Former Employee

Will the current month be based off Today's month or some other month ?  For example, it might be the most recent month in your data .

Still a bit of guess work, but if your data field is 'Month' and it stores values as 1-12, here are your  2 expressions. Sales is the $ amount field of the Sales.

Current Month:      Sum  (  {$<Month = {'$(=Num(Month(Today())))'}>}  Sales)

Previous Month:    Sum  (  {$<Month = {'$(=Num(month(AddMonths(Today(),-1))))'}>}  Sales)