Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Script Issue with MAX function

     Hello all,

I'm new to Qlikview.

I have a situation like i got 100 million product details.

where productID will be unique but when ever the details changes we will have a new productdetailID.

I have to pick a latest one.

& My table have only ProductID & ProductDetailID fields.

when i'm using MAX function & grouping by ProductID.

I'm getting an invalid expression in script.

I tried MAXNUM which didn't worked.

Can anyone help me with this issue please.

thanks a lot to you all.

4 Replies
MayilVahanan

HI

Try with FirstSortedValue() function

or

group by ProductID desc; // can able to use group by createdon desc;

hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

Hi Mayil Vahanan,

Tried using firstsortedvalue(ProductdetailID,ProductID)

which gave me same error as

" Invalid Expression ".

tried max(productdetailID)

group by productID.

which gave me same error stating.

"Invalid Expression "

Not applicable
Author

Hi ,

If ProductdetailID is a text.

Tried using MaxString() function.

As follows:

LOAD ProductID,

     MaxString(ProductdetailID) as ProductdetailID

FROM

maxProduct.xlsx(ooxml, embedded labels, table is Sheet1)

group by ProductID;

hope it helps.

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this in script

Products:

LOAD

     *,

WHERE IsLatestProduct = 1;

LOAD

     ProductID,

     ProductDetailID,

     If(ProductID <> Previous(ProductID), 1, 0) AS IsLatestProduct

FROM DataSource

ORDER BY ProductID, ProductDetailID DESC;

Hope this helps you.

Regards,

Jagan.