# Qlik Sense App Development

New Contributor II

## Get Sales vs Last Month Sales for each month

Hi experts,

I have following information in my table

• Region (with 3 regions A, B & C)
• Month (ex. 31/07/17 formatted as Jul-17)
• Sales \$

In my report, I have a filter that lets me choose my month and now,I would like to show 6 KPI's which are the sales for each region, both for the chosen month as for the "chosen month -1".

I managed to set the 3 KPI's for the sales per region, per month but I cannot find a solution for the previous month.

• Sales for Region A for chosen month : Avg({\$<[Region]={"A"}>}[Sales])
• Sales for Region A for chosen month -1 : ?

Any idea how I could do this?

Tags (2)
1 Solution

Accepted Solutions
MVP

## Re: Get Sales vs Last Month Sales for each month

Perhaps

=Avg({\$<[Region] = {"A"}, Month = {"\$(=Date(AddMonths(Month, -1), 'MMM-yy'))"}>} Sales)

3 Replies
Contributor III

## Re: Get Sales vs Last Month Sales for each month

‌Maybe ,

Avg({\$<[Region]={"A"}, month = {"=num(month-1)"} >}[Sales])

MVP

## Re: Get Sales vs Last Month Sales for each month

Perhaps

=Avg({\$<[Region] = {"A"}, Month = {"\$(=Date(AddMonths(Month, -1), 'MMM-yy'))"}>} Sales)

New Contributor II

## Re: Get Sales vs Last Month Sales for each month

Thanks Jonathan & Vishnu!

It worked :-)