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

Extract daily data from cumulative data table (today - yesterday)

Hi,


I have more questions real time using Qlik. Hope this will help others as well.


I have a table names as 'purchase'.


PURCHASE:


Date                           Customer_Name          Purchase_count (Cumulative)


10-09-2017                John                              43056

10-09-2017                Ryan                              44000

10-09-2017                Martin                          45600

10-10-2017                John                              45900

10-10-2017                Ryan                              46700

10-10-2017                Martin                          47000

10-11-2017                John                              47900

10-11-2017                Ryan                              48500

10-11-2017                Martin                           50000


How can I extract daily data from this table?  (Today - yesterday) will give me daily value. I tried using FirstSortedValue(), but of no luck. I have 2 simple questions.

1. Please let me know what is the better way to extract daily values,  At the time of loading  table or while writing in the expression on chart?

2. Please help me with the script for what ever the better way you suggest.


Thank you.

11 Replies
sunny_talwar

Or this

Table:

LOAD * INLINE [

    Date, Cust, Cum_Purchase_Count

    10-09-2017, John, 43056

    10-09-2017, Ryan, 44000

    10-09-2017, Martin, 45600

    10-10-2017, John, 45900

    10-10-2017, Ryan, 46700

    10-10-2017, Martin, 47000

    10-11-2017, John, 47900

    10-11-2017, Ryan, 48500

    10-11-2017, Martin, 50000

];

FinalTable:

LOAD *

Where Len(Trim(Daily_Purchase_Count)) > 0;

LOAD *,

If(Cust = Previous(Cust), RangeSum(Cum_Purchase_Count, -Previous(Cum_Purchase_Count))) as Daily_Purchase_Count

Resident Table

Order By Cust, Date;

DROP Table Table;

Capture.PNG

Anonymous
Not applicable
Author

Just amazing! It worked like Charm! Good contribution. I appreciate your help! stalwar1‌. Thanks alot.