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: 
murti
Contributor II
Contributor II

how to add -1 yearMonth value of a column to actual yearMonth Column ?


Sum(
if(recurring_month = 12 AND (status_id = 'future_payment' OR status_id = 'success'),
amount
)
)
* vNewRaise * vRenewalRate +
(sum({<FlagDate = {'due_date'}>} amount) )
- (sum({<status_id = {'cancelled'}>} amount) ) 

I have an expression like this lemme give the example of it that version of the code is adding fourth and the six columns value and find the value at the seventh column in the same row. My aim is to add fourth column one below value to the same one and I want to put the result at the same place at seventh column. To make it more clear, 416,223 + 2,951,106 = 3,367,229 but I want it to do 286,433 + 2,951,106 = 3,237,539 the miss calculation happens bc of in my opinion but help is appreciated!!

 Sum(
if(recurring_month = 12 AND (status_id = 'future_payment' OR status_id = 'success'),
amount
)
)
* vNewRaise * vRenewalRate  

1 Reply
Ryan_McGregor
Contributor II
Contributor II

Hello there, 

If I understand correctly, you can use a variable in the load script, then set analysis, to show your 'amount' for the most previous month, here is the variable:

LET vMonthName = MonthName(date(floor(monthstart(addmonths(Today(),-1))), 'MM/DD/YYYY'));

This will find the most immediate previous month. Then you can use MonthNamefield = {'$(vMonthName)'} in your set analysis. You can make several variables by only changing the -1 to -2, -3, etc... and adding / subtracting the monthly totals.