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: 
vishavb007
Partner - Contributor III
Partner - Contributor III

Cumulative data

Hi All,

 

I am trying to get data on a daily level but I am not able to as I have raw data in cumulative format.

PLS find data for your reference. In this data, I am getting confirmed cases for a date but it is cumulative in nature, I would like to get my data in such a way that when I select the date as 02-05-2021 it will give me covid cases for that specific date only, For example, if I select data from the filter is 02-05-2021 then confirmed cases will be a number of cases on 02-05-2021 subtracted number of cases on the previous date which is 01-05-2021.

if I select data from the filter as 02-05-2021 then the output will be  655997-652368 equals 3629

Pls help me to write the logic for the same

DateStateDistrictConfirmed
01-05-2021MaharashtraMumbai652368
02-05-2021MaharashtraMumbai655997
03-05-2021MaharashtraMumbai658621
04-05-2021MaharashtraMumbai661175
05-05-2021MaharashtraMumbai665057
06-05-2021MaharashtraMumbai668085
1 Solution

Accepted Solutions
salonicdk28
Creator II
Creator II

Please try this in you script-

Add these 2 below lines in your Load  statement 

1) RowNo() as Row

2)IF(RowNo() = 1,Confirmed, (Confirmed - peek(Confirmed,-1))) as Actual

and after reloading add sum(Actual) in your expression

Hope this helps you!

Thanks,

Saloni

View solution in original post

2 Replies
salonicdk28
Creator II
Creator II

Please try this in you script-

Add these 2 below lines in your Load  statement 

1) RowNo() as Row

2)IF(RowNo() = 1,Confirmed, (Confirmed - peek(Confirmed,-1))) as Actual

and after reloading add sum(Actual) in your expression

Hope this helps you!

Thanks,

Saloni

vishavb007
Partner - Contributor III
Partner - Contributor III
Author

Thanks a lot for your help.

 

Best,

Vishav Bhatia