Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
rosemary
Contributor
Contributor

Last Value for Current Month vs. Last Value for Previous Month

Hi All,

I would like to show in KPI the % change of the total number of products for current month vs. previous month. The point is, I have cumulative values. Please see below the example:

rosemary_0-1619191983294.png

In this example, to get the percent change, I should calculate this: (189-139)/139=0,359, what give us 35,9%.

I am not sure how calculate it in Qlik? I know that for the last value, I can use formula: FirstSortedValue. But here comes the last value for the previous month.

I would be grateful for your help.

 

Best regards,

Rosemary

Labels (1)
1 Reply
GaryGiles
Specialist
Specialist

Instead of FirstSortedValue, you could use something like this:

(Only({$<Date={'$(=max({$<Date={">=$(=MonthStart(Today()))<=$(=MonthEnd(Today()))"}>} Date))'}>} [Total Number of Product]) -

Only({$<Date={'$(=max({$<Date={">=$(=MonthStart(AddMonths(Today(),-1)))<=$(=MonthEnd(AddMonths(Today(),-1)))"}>} Date))'}>} [Total Number of Product]) ) /

Only({$<Date={'$(=max({$<Date={">=$(=MonthStart(Today()))<=$(=MonthEnd(Today()))"}>} Date))'}>} [Total Number of Product])

This assumes that you have one date row per product.