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: 
rustyfishbones
Master II
Master II

Product Table has Unique ProductID with 3 Description

Hi,

I have a table with the following

ProductID           Product Description

M001                 XYZ123

M001                 XYZ123/5

M001                 XYZ123/6

The description does not really matter, but i need to keep 1 Product Description anyway

I tried using MAXSTRING(Product Description) AND GROUP BY ProductID, but it aint working

Product:

     LOAD

          ProductID

          Product Description

     FROM [Product.qvd](qvd);

Thanks

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Try the firstvalue function:

Product:

     LOAD

          ProductID

          firstvalue([Product Description])

     FROM [Product.qvd](qvd)

     group by ProductID;


talk is cheap, supply exceeds demand

View solution in original post

5 Replies
Gysbert_Wassenaar

Try the firstvalue function:

Product:

     LOAD

          ProductID

          firstvalue([Product Description])

     FROM [Product.qvd](qvd)

     group by ProductID;


talk is cheap, supply exceeds demand
rustyfishbones
Master II
Master II
Author

Invalid Expression is returned in the Script Error

rustyfishbones
Master II
Master II
Author

I got it working thanks G.

I had other fields in the table which were causing it not to work.

Can the FIRSTVALUE Function be used more than once in the same table?

Thanks again

Gysbert_Wassenaar

Sure, you can use the firstvalue function on any field as long as they are aggregated on the same fields by the group by clause. It's just another aggregation function like sum, count, avg, concat etc.


talk is cheap, supply exceeds demand
rustyfishbones
Master II
Master II
Author

Thanks