Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

ratio of this month and last month

Hello,

I have following table and want to have a ratio between current month and last month, how about the expression ?

YearMonthSales
20141100
20142220
20143300
20144120
20145400

Is my below expression correct ?

Sum(sales)-sum({<Month=(Month-1)>} sales)

Expecting view is like below.

Snap6.gif

Thanks&Regards,

Jessica

11 Replies
sunny_talwar

Try this may be:

=Sum(Sales)/If(Sum(Sales) > 0, Above(Sum({<Month = >}Sales)))

Not applicable
Author

Hi Sunny,

It does not work

Thank you

Jessica

sunny_talwar

Isn't this the output you are expecting to see from your given sample above??

Capture.PNG

Expression: =Sum(Sales)/If(Sum(Sales) > 0, Above(Sum({<Month = >}Sales)))-1

qlikmsg4u
Specialist
Specialist

Jessica,

sunindia‌ solution will work

See the attached app

Anonymous
Not applicable
Author

Try This..

=((SUM(SALES) - Above(SALES))/Above(SALES)) * 100

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this

=If(RowNo() = 1, 1, (Sum(Sales) -  Alt(Above(Sum(Sales)), 0) )/ Alt(Above(Sum(Sales)), 0)


Hope this helps you.


Regards,

Jagan.

Not applicable
Author


hi, this express is correct, thank you!

Regards,

Jessica

sunny_talwar

Awesome

I am glad I was able to help.

Best,

Sunny

qlikviewwizard
Master II
Master II

Hi Try this modified Jagan's Expression.

=If(RowNo() = 1, 1, (Sum(Sales) -  Alt(Above(Sum(Sales)), 0) )/ Alt(Above(Sum(Sales)), 0))