Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Not applicable

how to get actual difference b/w two rows in a same table

I would like to have a two date filters on same page . If I choose the dates then I would get the difference of price between those two dates.

Ex :  Filters on page like FromDate  ToDate

if the fromDate = 02-11-2016 and ToDate=17-11-2016

Then I should the derived value as 39.6 i.e. 1091.1 - 1051.5

Can anybody help on how to achieve this in qlik sense ???

   

CompanyPriceDate
5000021091.102-11-2016
5000021087.6503-11-2016
5000021085.0504-11-2016
5000021088.308-11-2016
5000021056.309-11-2016
5000021065.5510-11-2016
5000021066.9511-11-2016
5000021051.517-11-2016
5000021046.0518-11-2016
500002106522-11-2016
5000021062.5523-11-2016
5000021055.7524-11-2016
5000021057.425-11-2016
5000021059.628-11-2016
5000021055.629-11-2016
5000021055.5501-12-2016
5000021051.9502-12-2016
5000021044.0505-12-2016
5000021056.5508-12-2016
5000021056.109-12-2016
5000021046.713-12-2016
5000021046.614-12-2016
5000021051.7515-12-2016
5000021058.416-12-2016
5000021048.419-12-2016
5000021029.2522-12-2016
2 Replies

Re: how to get actual difference b/w two rows in a same table

If the FromDate and ToDate fields are not related to each other and to the Date field then this could work:

sum({<Date={"$(=Date(Max(ToDate),'DD-MM-YYYY'))"}>}Price)-sum({<Date={"$(=Date(Max(FromDate),'DD-MM-YYYY'))"}>}Price)


talk is cheap, supply exceeds demand
parimikittu
Contributor II

Re: how to get actual difference b/w two rows in a same table

Create a date filter with 'Date' Column.

Create a Text Object with below Code

sum({<Date={"$(=min(Date))"}>}Price)-sum({<Date={"$(=max(Date))"}>}Price)

Explanation: Using Set Analysis, We get the Min Date using "$(=Min(Date))" , which is passed to Date and This logic will make selection and using sum(aggregration func) of price will be calculate which is Sum(price for min date in our selection)

Simalrly Max as well. Let me know if you have any queries.

Community Browser