Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 domibs
		
			domibs
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hello, I've created the below KPI calculation to get the variation between the first price et the last price :
((LastValue("Price"))-(FirstValue("Price")))/(FirstValue("Price"))
The calculation works but when I filter on month (field "[Year month]"), the result of the KPI calculation does not change with the selection.
For exemple :
| Reference | Year month | Price | 
| 123990 | 2020-10 | 2,85 € | 
| 123990 | 2020-12 | 2,85 € | 
| 123990 | 2021-04 | 2,95 € | 
| 123990 | 2021-10 | 3,25 € | 
| 123990 | 2022-03 | 3,35 € | 
| 123990 | 2022-04 | 3,70 € | 
The variation between the last price and the first price in this table is 29,82% ((3,70-2,85)/2,85).
If I filter only on few months, I get the below table. And the result of the KPI calculation should be : 13,85% ((3,70-3,25/3,25).
| Reference | Year month | Price | 
| 123990 | 2021-10 | 3,25 € | 
| 123990 | 2022-03 | 3,35 € | 
| 123990 | 2022-04 | 3,70 € | 
However, the result does not change with the month selection in my Qlik application.
Could you please help me to find the solution ?
Thank you,
Have a great day,
 Angela_Zhou
		
			Angela_Zhou
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		How about,
(firstsortedvalue(Price, -[Year month]) - firstsortedvalue(Price, [Year month]))
/
firstsortedvalue(Price, [Year month])
Here, for any selected [Year month] with assumption of this field can be sorted in ASC order by year + month, then:
