Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
andrea0901
Creator
Creator

calculating previous month and current month in backend script in qliksense

Hi ,

I have an requirement as below:

Region, Actual Value, Target, UnitOfTime, Date

ABC,123,345,MTD,20200801

DEF,456,789,MTD,20200701

RGR,908,998,MTD,20200601

etc....

i need to calculate the difference of current month actual value and previous month actual value and store the value in a new field  in backend script not in front end. 

 

example: current month - 20200801 actual value is 123and previous month value  - 20200701 is 456

Current month - Previous month as New field in back end script. 

please help me how to write in backend scirpt.

Labels (1)
1 Reply
bramkn
Partner - Specialist
Partner - Specialist

You could do this by sorting on the date and probably the Region.

then create a field within the table like this:

if(previous(Region) = Region, Actual Value- previous(Actual Value),0) AS Difference_with_previous_month

 

Not sure if this is exactly what you are looking for, but hope it will help you get your solution.