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: 
Saurabh07
Contributor III
Contributor III

To get values for current and previous dates selected

Hello Gurus,

I have a requirement here. Below is the data with me:

Countrycal_dateValue
India01-01-202026
India01-02-202093
India01-03-202033
India01-04-202020
Japan01-01-202034
Japan01-02-202076
Japan01-03-202022
Japan01-04-202026
China01-01-2020100
China01-02-202072
China01-03-202033
China01-04-202034
Germany01-01-202063
Germany01-02-202019
Germany01-03-202049
Germany01-04-202010

I need  a pivot table in Qlik app, with columns Country and difference Value. I have a filter with date at top and if I select '01-04-2020' in filter the difference Value for each country should give me the difference of value for '01-04-2020' and '01-03-2020'.  For eg, if we consider Germany, the difference value should give 39 (i.e. 49-10).

I am using this expression, but it doesn't work

'Sum({<Date = {"$(=Date(max(cal_date,1)))"}>} Value) - Sum({<Date = {"$(=Date(max(cal_date,2)))"}>} Value)'

Any help here would be highly appreciated.

1 Reply
chrismarlow
Specialist II
Specialist II

Hi,

You could try;

Sum({<cal_date= {'$(=Date(Max({<cal_date={"<$(=getfieldselections(cal_date))"}>} cal_date)))'}>} Value)-
Sum({<cal_date= {"$(=Date(max(cal_date)))"}>} Value)

Cheers,

Chris.