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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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

Thanks in advance

1 Solution

Accepted Solutions
Nicole-Smith

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.

View solution in original post

3 Replies
Nicole-Smith

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.

Anonymous
Not applicable
Author

Hi Nicole

I do not see attachment.

Thanks

Anonymous
Not applicable
Author

Thanks Nicole

I appreciate your correct answer