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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
greenyTBD
Contributor II
Contributor II

Formula Help - lowest value from 1 dimension based on another

Hi,

I'm stuck on a formula for 2 seperate KPI's.

I am trying to find the min Produced (column C) out of all Parts (column B) if the Product (column A) is equal to GGF and GGM respectively. 

123.png

Basically I'm trying to create the 2 KPI's in blue above.

Not sure where I'm going wrong but can't seem to get it to work. Managed to get the max value with:

max(total <Product> aggr(sum([Produced]),Product='GGF',Part)) 

that would spit out 88 but if I change it from max to min it would give me 0

if you can help please let me know 🙂

 

Labels (4)
1 Solution

Accepted Solutions
hic
Former Employee
Former Employee

If you want a KPI showing a value for a specific Product, you can try

Min({<Product={'FARM'}>} Aggr(If(Sum([Qty.])>0,Sum([Qty.])), Product, Part))

Why it shows 1 for 'MASTER', I don't know. 

View solution in original post

4 Replies
hic
Former Employee
Former Employee

If you get 0 when you use Min(), it probably means that you have parts where Sum(Produced) is 0.

Try creating a table with only one dimension - Product - and use the following as measure

Min(Aggr(If(Sum(Produced)>0,Sum(Produced)), Product, Part))

greenyTBD
Contributor II
Contributor II
Author

Thank you for taking the time!

Sorry but I am not sure what you mean by 'Try creating a table with only one dimension'. I am trying to create a standalone KPI, not a table. Or do you mean uploading/creating a separate table in my data? (Sorry I'm still very new to all this..)

I will share my actual qlik sense images. Names are a little different but it's the same idea.

qs1.jpg

I tried inputting your formula. It works when I filter for 'FARM' and displays 41. But it does not work when filtering for 'MASTER'. It still displays 1 , when it should show 2. 

qs2.jpgqs3.jpg

But also, I don't want to have to filter to see each number. I would want the KPI to stand alone and have the filter in the formula so I can have them both next to each other.

Any idea if that's possible?

hic
Former Employee
Former Employee

If you want a KPI showing a value for a specific Product, you can try

Min({<Product={'FARM'}>} Aggr(If(Sum([Qty.])>0,Sum([Qty.])), Product, Part))

Why it shows 1 for 'MASTER', I don't know. 

greenyTBD
Contributor II
Contributor II
Author

Ended up finding the error in my data. Cleaned it up and the formula you provided worked perfectly.

Thank you! Really appreciate your help