# New to QlikView

Discussion board where members can get started with QlikView.

New Contributor III

## % increase from last month

Hello,

I have an expression for total payments :

(Sum({<Account={'2000','2001','2002','2003'}>}Trans))*-1

How would I create a measure for % increase in payments from previous month?

I want this to be rolling dates as I load new data every month. So I want...(total for last month-total for current month)/ Total for last month).

Tags (3)
1 Solution

Accepted Solutions
MVP

## Re: % increase from last month

Do this in the script to create a new field and then use that as your filter.

Date(MonthStart(TransactionDate), 'MMMM YYYY') as MonthYear

and then use this expression

Sum({<Account = {'2000','2001','2002','2003'}, TransactionDate = {"\$(='>=' & Date(MonthStart(Max(TransactionDate)), 'MM/DD/YYYY') & '<' & Date(MonthStart(Max(TransactionDate), 1), 'MM/DD/YYYY'))"}, MonthYear>}Trans)/

Sum({<Account = {'2000','2001','2002','2003'}, TransactionDate = {"\$(='>=' & Date(MonthStart(Max(TransactionDate), -1), 'MM/DD/YYYY') & '<' & Date(MonthStart(Max(TransactionDate)), 'MM/DD/YYYY'))"}, MonthYear>}Trans) - 1

26 Replies
MVP

## Re: % increase from last month

Is this in a chart where Month or MonthYear is a dimension? If it is, then try this may be

Sum({<Account={'2000','2001','2002','2003'}>}Trans)/Above(Sum({<Account={'2000','2001','2002','2003'}>}Trans)) - 1

New Contributor III

## Re: % increase from last month

No I want to display it as a KPI at the top of a sheet above other charts. I have a dimension for month year...and I would like it to update with those selections. The date field is called 'TransactionDate'.

MVP

## Re: % increase from last month

So, you would want to compare the max(MonthYear) to its previous? or compare today's month to its previous?

New Contributor III

## Re: % increase from last month

Today's month or max month, to previous month (same year).

But I would also like the option to compare to same month (previous year). Could you do both?

MVP

## Re: % increase from last month

You sure can, it will just help to know what date and time related fields do you have and what are there formats

New Contributor III

## Re: % increase from last month

The date field is 'TransactionDate'  fomat 'mm/dd/yyyy'

MVP

## Re: % increase from last month

May be try this

Sum({<Account = {'2000','2001','2002','2003'}, TransactionDate = {"\$(='>=' & Date(MonthStart(Max(TransactionDate)), 'MM/DD/YYYY') & '<' & Date(MonthStart(Max(TransactionDate), 1), 'MM/DD/YYYY'))"}>}Trans)/

Above(Sum({<Account = {'2000','2001','2002','2003'}, TransactionDate = {"\$(='>=' & Date(MonthStart(Max(TransactionDate), -1), 'MM/DD/YYYY') & '<' & Date(MonthStart(Max(TransactionDate)), 'MM/DD/YYYY'))"}>}Trans)) - 1

New Contributor III

It gives me NULL

MVP

## Re: % increase from last month

Would you be able to provide a sample?