If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.
I have a problem to find the closeset number with qliksense .
I have a value x = 3 and i have a colunm A that contains (1,2,4,5,9).
I want a function that returns 2 as the closeset value to my x
if x for example change to 6 my closeset number will be 5
if x =2 then 2.....
Thank you in advance.
When x=3, then you want 2 and not 4 (both being closest). Is it always such that in case of tie - you want lower value?
Assuming your x a variable, you could try like:
=FirstSortedValue(DISTINCT [Col A], fAbs([Col A]-VariableX))
View solution in original post
i want to be always the lower value. its not the case with this formula
=FirstSortedValue( [Col A], if([Col A]<=VariableX,VariableX-[Col A]))