3 Replies Latest reply: Sep 19, 2017 5:13 PM by Satish Kamath

# Subtract Previous month value from Present month value

Hi All

Base on MonthYear selection(on Left) I want to see the Selected Month Value - Previous Month Value for Selected Month

So let see below two scenario

Scenario 1: Jun-2012

Scenario 2: Juj-2012

In case of Scenario 2(if I Select Jul-2012) I want to show for each and every cell

1. ▲(alt + 30) if(Jul-2012 > Jun-2012)  OR

2. ▼(alt + 31) if(Jul-2012 < Jun-2012)

3. else Blank

Note: test.qvw attached

• ###### Re: Subtract Previous month value from Present month value

I believe this expression accomplishes what you're asking:

```if(
/* Selected Month */ sum(InvoiceValue) -
/* Previous Month */ sum({<MonthYear={\$(=chr(39) & date(AddMonths(MonthYear, -1), 'MMM-YYYY') & chr(39))}>}InvoiceValue)
> 0, '▲',
if(
/* Selected Month */ sum(InvoiceValue) -
/* Previous Month */ sum({<MonthYear={\$(=chr(39) & date(AddMonths(MonthYear, -1), 'MMM-YYYY') & chr(39))}>}InvoiceValue)
< 0, '▼'
, ''))
```

I've also attached your test file with this expression included.

• ###### Re: Subtract Previous month value from Present month value

Hi Nicole

I do not see attachment.

Thanks

• ###### Re: Subtract Previous month value from Present month value

Thanks Nicole