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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to calculate previous month data with current selected one

Hi,

i have a field year contains jan,feb,mar........with sum(sales) as another field.

i need to calculate the difference between current selected month and previous month.(ie)if i selected feb month then the result should find difference between jan and feb.....

pls,help me out thanks in advance.

2 Replies
vgutkovsky
Master II
Master II

There are several ways to do this. The best methods use set analysis. Within set analysis, then, there are several different approaches. For example: sum( {$<MonthYear = {$(#=Only(MonthYear)-1)}>} Sales ). This was taken directly from the Help file; search for "set analysis" for more details and other ideas (the above is not the simplest solution in your case).

Regards,

kaushalview
Partner - Creator II
Partner - Creator II

Hi

Koushik

Use given expression for ur problem

PMTD=sum({$Year={$(=max(Year)-$(=if(max(Month)=1,1,0)))},Month={$(=Month(addMonths(Max(orderDate),-1)))}>}Sales)

Regrads

Kaushal Mehta