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

Announcements
Join us in Zurich on Sept 24th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Dayna
Creator II
Creator II

How to pick one value

Hello All,

I'm sure this is an easy one for you.. I have a field where there should only ever be one value, but in the case of two I want to only want to select one.

I was thinking a min(site) or firstsortedvalue, but I don't have a date field or anything that I can use. I'm not bothered which one of the two values it uses, aslong as I only get one - so I was thinking of doing it within my load script.

I hope you can help me!

Kind Regards,
Dayna

1 Solution

Accepted Solutions
Miguel_Angel_Baeyens

Hello Dayna,

Use MaxString() that works as any other aggregation function (needs a group by in the script and so).

Hope that helps.

View solution in original post

5 Replies
suniljain
Master
Master

you can use Firstsortedvalue(),Firstvalue()

Dayna
Creator II
Creator II
Author

How do I use it within the load script, as I keep getting errors?

Firstsortedvalue I couldn't get to work due to the lack of a sort weight field as above, so looking at firstvalue().

suniljain
Master
Master

LOAD
DISTINCT SHIP_TO_CUSTOMER,
Firstvalue(SHIP_TO_CUST_GRP5_DESC) as SHIP_TO_CG5

RESIDENT SHIP_TO GROUP BY SHIP_TO_CUSTOMER; //OK

Miguel_Angel_Baeyens

Hello Dayna,

Use MaxString() that works as any other aggregation function (needs a group by in the script and so).

Hope that helps.

Dayna
Creator II
Creator II
Author

That's what I wanted! Cheers again Miguel!