Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 Saurabh07
		
			Saurabh07
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hello Gurus,
I have a requirement here. Below is the data with me:
| Country | cal_date | Value | 
| India | 01-01-2020 | 26 | 
| India | 01-02-2020 | 93 | 
| India | 01-03-2020 | 33 | 
| India | 01-04-2020 | 20 | 
| Japan | 01-01-2020 | 34 | 
| Japan | 01-02-2020 | 76 | 
| Japan | 01-03-2020 | 22 | 
| Japan | 01-04-2020 | 26 | 
| China | 01-01-2020 | 100 | 
| China | 01-02-2020 | 72 | 
| China | 01-03-2020 | 33 | 
| China | 01-04-2020 | 34 | 
| Germany | 01-01-2020 | 63 | 
| Germany | 01-02-2020 | 19 | 
| Germany | 01-03-2020 | 49 | 
| Germany | 01-04-2020 | 10 | 
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.
 
					
				
		
 chrismarlow
		
			chrismarlow
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		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.
