Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
loganathan
Contributor III
Contributor III

How get 'difference' from today's - sales amount minus yesterday's sales amount

Hi All,

I not familiar in Qliksense and need help on below logic.
basically i have populate 'Difference' column in table (not in report). To find the 'Sales difference' by calculating Today's 'Sales Amount' minus Yesterday's
'Sales Amount' to generate the column 'Difference' as attached in data table. and it has to be by
SaleID, Desc, Reported Date and Sale Date. for more details please find the attached sample data excel. where it has excel formula to populate 'Difference' column.

Sample data.png

 

Thanks & Regards
Loga

 

Labels (2)
1 Solution

Accepted Solutions
Kingmaker
Contributor
Contributor

Use previous or peek function to pick previous value

 

View solution in original post

4 Replies
Lisa_P
Employee
Employee

Use Sum(Sale Amount) as a measure, name it Amount, then use this formula:

Amount - Above(Total Amount, 1, 1)

Lisa_P_0-1719444957409.png

 

loganathan
Contributor III
Contributor III
Author

Hi Lisa,

Thanks for your effort. but i want this to be created in table means in 'edit script' as a field. and its has to grouped by Reported date and SaleID.

Kingmaker
Contributor
Contributor

Use previous or peek function to pick previous value

 

amonjaras_c40
Luminary
Luminary

Hello!

To do it in the script, let’s assume you have loaded your table as Table 1, then:

Table2:

Noconcatenate Load

SaleID,

Desc,

[Reported Date],

[Sale Date],

[Sale Amount],

if(SaleID=peek(SaleID) and [Reported Date]=peek([Reported Date]), [Sale Amount]-peek([Sale Amount]),[Sale Amount]) as Difference

Resident Table1

Order by SaleID,[Reported Date],[SaleDate];

Hope this helps!