Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
qliksus
Specialist II
Specialist II

Regarding getting sum(value) of the prev month same date

Hi,

I have a table which contain datas like,

Sample data is

Date, Sales

15/10/2009, 200

16/10/2009, 300

17'10/2009, 400

15/11/2009, 250,

16/11/2009, 350,

17/11/2009, 450

Now my requirement is like if i select 16/11/2009 it should show me value for same day with prev month i.e 16/10/2009 value i.e 300 and in another column ratio of 16/11/2009 value to 16/10/2009 i.e 350/300

And also full month i.e 11 then it should calculate ratio of full month value of 11 with full month value of prev month i.e 1050/950

Can anyone help me how to solve it by using set analysis?????

1 Solution

Accepted Solutions
Miguel_Angel_Baeyens

Hi

Try something like

(SUM({<Date = {$(#=Date(Date))}>} Sales) - before(SUM({<Date = {$(#=AddMonths(Date(Date)),-1,0)} >} Sales)) / before(SUM({<Date = {$(#=AddMonths(Date(Date)),-1,0)}>} Sales))


View solution in original post

5 Replies
Miguel_Angel_Baeyens

Hi

Try something like

(SUM({<Date = {$(#=Date(Date))}>} Sales) - before(SUM({<Date = {$(#=AddMonths(Date(Date)),-1,0)} >} Sales)) / before(SUM({<Date = {$(#=AddMonths(Date(Date)),-1,0)}>} Sales))


Not applicable

Here is a simple example where I have multiple columns doing month to date comparisons for sequential months. In this case I just verify a date is in the month in question and sum the values


//current month
=sum(
if(
InMonthToDate(ORDERDATE, Today(), 0),
AMOUNT
)
)

//for the previous month
=sum(
if(
InMonthToDate(ORDERDATE, Today(), -1),
AMOUNT
)
)


qliksus
Specialist II
Specialist II
Author

hi Miguel,

For last month same day it is working properly. Thanks for the solution. Now i want last MTD wise so i am working on that.

qliksus
Specialist II
Specialist II
Author

Hi kal,

Thanks for the solution. But unfortunately what you have sugested that for without selection but if u select some particular date then it is not working . So i am working on that.

qliksus
Specialist II
Specialist II
Author

hi Miguel,

Thanks for solution MTD wise also coming.