Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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 ???
Company | Price | Date |
500002 | 1091.1 | 02-11-2016 |
500002 | 1087.65 | 03-11-2016 |
500002 | 1085.05 | 04-11-2016 |
500002 | 1088.3 | 08-11-2016 |
500002 | 1056.3 | 09-11-2016 |
500002 | 1065.55 | 10-11-2016 |
500002 | 1066.95 | 11-11-2016 |
500002 | 1051.5 | 17-11-2016 |
500002 | 1046.05 | 18-11-2016 |
500002 | 1065 | 22-11-2016 |
500002 | 1062.55 | 23-11-2016 |
500002 | 1055.75 | 24-11-2016 |
500002 | 1057.4 | 25-11-2016 |
500002 | 1059.6 | 28-11-2016 |
500002 | 1055.6 | 29-11-2016 |
500002 | 1055.55 | 01-12-2016 |
500002 | 1051.95 | 02-12-2016 |
500002 | 1044.05 | 05-12-2016 |
500002 | 1056.55 | 08-12-2016 |
500002 | 1056.1 | 09-12-2016 |
500002 | 1046.7 | 13-12-2016 |
500002 | 1046.6 | 14-12-2016 |
500002 | 1051.75 | 15-12-2016 |
500002 | 1058.4 | 16-12-2016 |
500002 | 1048.4 | 19-12-2016 |
500002 | 1029.25 | 22-12-2016 |
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)
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.