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

Month to Month comparison

Hi All,

I need to compare month to month data and calculate the difference between the current and the prior month :

Code           |               Period                        |        Sales         | Diff

----------------------------------------------------------------------------------------

11                |               201801                      |      2100            |    0

11                |               201802                      |      1800            |    -300

11                |               201803                      |      2600            |    800

11                |               201804                      |      1100            |    -500

11                |               201805                      |      4100            |    3000

11                |               201806                      |      6100            |    2000


I created those expressions but it doesn't work:

sum({<[Calendar Year/Month] = {"$(=Date(Addmonths([Calendar Year/Month],-1),'YYYYMM'))"}>} RB)

Can anyone help please ?

thanks

1 Solution

Accepted Solutions
sunny_talwar

Try this

Alt(Sum(RB) - Above(Sum(RB)), 0)

or

Alt(Sum(RB) - Above(TOTAL Sum(RB)), 0)

View solution in original post

4 Replies
zebhashmi
Specialist
Specialist

try that

sum({<[Calendar Year/Month] = {">=$(=Date(Addmonths([Calendar Year/Month],-1),'YYYYMM'))<=$(=Date([Calendar Year/Month]),'YYYYMM'))"}>} RB)

sunny_talwar

Try this

Alt(Sum(RB) - Above(Sum(RB)), 0)

or

Alt(Sum(RB) - Above(TOTAL Sum(RB)), 0)

Anonymous
Not applicable
Author

Hi,

thanks for the response but unfortnately it doesn't return any result.

Anonymous
Not applicable
Author

Hi,

Thanks for your response.

it works