Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
124psu
Creator II
Creator II

using min value to retrieve column value

Hello, I am trying to create a 5th column to return me the product_description values based on the importance_weight. 

This is a sample data but I would like output to be a concatenation of the [product_description] field based on the [importance_weight] column.

in this case, for sales_id ='1', the value should be: Uses MBC - chip fyx, Uses PLZ - chip xx 

since they both have the same weight. 

for sales_id ='2', value should be: Testing - chip xyy since the weight of 1 is > 3. 

I was trying to possibly grab the min(importance_weight) and return the product_description but not working as expected. 

thank you.

sales_id product_description importance_weight product_date
1 Uses MBC - chip fyx 2 1/30/2024
1 Uses PLZ - chip xx 2 1/30/2024
2 Testing - chip xyy 1 12/5/2023
2 Uses KTX - brd423 3 12/6/2023
Labels (1)
3 Replies
pallavsi_08
Contributor II
Contributor II

Hello,

Utilizing the aggr function is possible.

Simply focus on the screenshot's final column.

I hope you can use this.

pallavsi_08_0-1708492483164.png

 

LRuCelver
Partner - Creator III
Partner - Creator III

LRuCelver_0-1708501222883.png

 

Concat(
Aggr(
If(
importance_weight = Min(total <sales_id> importance_weight),
product_description
),
product_description, sales_id
),
', '
)
124psu
Creator II
Creator II
Author

Thank you for your assistance. It is working as expected but is very slow on the chart expression.

Trying to apply this on the script level but having problems doing this using a temp and resident load. Thank you again.

temp1:
*,
Concat(If(
importance_weight = Min(total <sales_id> importance_weight),
product_description
),' , ') as TEST_SCRIPT_DIMENSION
RESIDENT MY_MAIN
GROUP BY product_description, sales_id
ORDER BY sales_id;