Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Akina0929
Creator
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
vikasdesai
Partner - Contributor III
Partner - Contributor III

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

View solution in original post

4 Replies
tresesco
MVP
MVP

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

Anonymous
Not applicable

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

vikasdesai
Partner - Contributor III
Partner - Contributor III

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

devarasu07
Master II
Master II

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).

Capture.JPG

Fact:

load  * Inline [

month, sales

jan,200

feb,400

mar,750

apr,900

may,1023

jun,1200];

[Month Sort]:

load * inline [

monthno,month

1,jan

2,feb

3,mar

4,apr

5,may

6,jun];