# New to QlikView

Discussion board where members can get started with QlikView.

Announcements
QlikWorld, June 24-25, 2020. Free virtual event for DI and DA gurus. Register Now
cancel
Showing results for
Did you mean:
Highlighted
Creator

## how to show sales difference for current month and previous month based on selection?

HI All,

I have following table

month, sales

jan,200

feb,400

mar,750

apr,900

may,1023

jun,1200

I want to show sales difference  in Text box . if i select march it should show difference from march sales to feb sales,if i select jun it should show it should show difference from jun to may.based on current it should display.please help me.

Regards

Anji

1 Solution

Accepted Solutions
Highlighted
Partner

## Re: how to show sales difference for current month and previous month based on selection?

Hello,

Use following expression to calulate the sales difference for current month and previous month based on selection

Sum({\$<Month={\$(=Max(Months))}>}sales) - Sum({\$<Month={\$(=Max(Months)-1)}>}sales)

Regards,

Vikas

4 Replies
Highlighted
MVP

## Re: how to show sales difference for current month and previous month based on selection?

Do you have year, date fields too? If yes, try to share some data/app with such data.

Highlighted
Creator

## Re: how to show sales difference for current month and previous month based on selection?

You can Show it with the Help of Two Text Box for current and Previous month using the Set Analysis

Sum({\$<Month={\$(=Max(Months))}>}sales)  // For Current Selection

Sum({\$<Months={\$(=Max(Months)-1)}>}Sales) // For Previous month

Highlighted
Partner

## Re: how to show sales difference for current month and previous month based on selection?

Hello,

Use following expression to calulate the sales difference for current month and previous month based on selection

Sum({\$<Month={\$(=Max(Months))}>}sales) - Sum({\$<Month={\$(=Max(Months)-1)}>}sales)

Regards,

Vikas

Highlighted
Master II

## Re: how to show sales difference for current month and previous month based on selection?

Hi Anji,

Refer to the attached sample, best way to derive using master calendar and  set analysis method, (real time u should have data in date format with historical period so u have to update this expression).

```Fact:
month, sales
jan,200
feb,400
mar,750
apr,900
may,1023
jun,1200];
[Month Sort]: