Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
paperjam
Contributor II
Contributor II

Min-Function not working as expected

Hi

I would like to get the minimum between a variable (vAnzTage) and a column (Zahlungstag_Max). However, the formula Min() is not working as epected - I get always the max resp. probably one Number is not taken into account

Example: For Kampagnennummer 6640 I have Num(Zahlungstax_Max) = 4 (column). Then I have vAnzTage = 11 (variable). With Min(Num(vAnzTage), Num(Zahlungstag_Max)) I expect 4 - but I get 11. Why? Doesn't make any sense to me...

Thanks for any help!! I'm totally lost and confused....

Labels (2)
1 Solution

Accepted Solutions
Or
MVP
MVP

You seem to be confusing Min() with RangeMin(). Try the latter.

View solution in original post

3 Replies
Or
MVP
MVP

You seem to be confusing Min() with RangeMin(). Try the latter.

paperjam
Contributor II
Contributor II
Author

Thank you Or. This works as a new calculated measure perfectly. However, then I have the following question:
I want to filter for this RangeMin Logic - now the maximum is taken again...

My formula:
Sum(
{< 
Kampagnennummer, 
Zahlungstag = {$(=RangeMin(vAnzTage, Zahlungstag_Max))}
>} 
KampagneBetragKumuliert)
 
What I expect for the first line:
Sum(
{< 
Kampagnennummer, 
Zahlungstag = {4}
>} 
KampagneBetragKumuliert)
 
What I get:
Sum(
{< 
Kampagnennummer, 
Zahlungstag = {19}
>} 
KampagneBetragKumuliert)
 
I guess Zahlungstag_Max is taken from the total. How to filter only for the row (Kampagnennummer)? Something with AGGR()?

 

paperjam_0-1739805517237.png

 



Or
MVP
MVP

I didn't quite follow the logic in your post. However, generally speaking:

Min() is an aggregation function. It checks records across any given number of dimensions (0..n) based on either the object it's in, or the aggr() function it's wrapped in, and returns the minimum numeric value among those values.

RangeMin() is not an aggregation function. It receives one or more numbers and returns the lowest number among those values.

I would suggest looking up both the aggregation scope documentation (or hic's posts on the subject) and dollar sign expansion documentation / posts to get a better idea of what putting these things in a set analysis might mean.