Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

conditional result for the expression in nested if

Hello all !

In one of my table I have a column to display the price which comes in variable 'M' from a QVD. My dimension is the item name and the corresponding price (Here 'M') should be shown. I have to show the latest price if more than one price is available in the QVD. The column to identify the latest price is 'MonthYear'. Please help me in modifying the expression so that it will display the latest price.

So here we have to modify the expression part of first if , that is Max (M) . It should be Latest(M) according to MonthYear column.

If(Count(DISTINCT(M))>1,Max(M),if(Count(DISTINCT(M))=0,0,if(Count(DISTINCT(M))=1,M)))

-J

28 Replies
vinieme12
Champion III
Champion III

try

firstsortedvalue(M,-MonthYear)

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
sunny_talwar

May be try this:

FirstSortedValue(M, -MonthYear)

Not applicable
Author

YaaY ! It works ! Thanks  a ton to both of you !

-J

Not applicable
Author

Sorry guys ! After full round of testing I found the expression firstsortedvalue(M,-MonthYear) was not working properly. Please help me out. stalwar1vinieme12

I have pasted the snap of my table with columns M with firstsortedvalue(M,-MonthYear) expression , M with Max(M) expression and Count(M) for your reference.

m firstsorted.JPG

Thanks,

James

vinieme12
Champion III
Champion III

Can you post a sample app?

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Not applicable
Author

Here you go . For the selected material there are more than one 'M price' . We have to display latest m price out of that. Check the expressions of all the objects in the dashboard.

-J

sunny_talwar

Where is this chart in the sample? Also what is the dimension here in the image you posted?

Not applicable
Author

Hello !

Please find the file attached. Item is the dimension here.

-J

Not applicable
Author

Hi stalwar1‌ ,

Is it possible to display the records as i expect ? Because I tried a lot but no luck at all

Regards,

J