Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Comparison using Set Analysis

Hi All,

Hope you are doing good.


I have to display the first year   where sale is less than the sale in the first row.

  

CountryYEARSales
INDIA2015500
AUSTRALIA2016876
CANADA2017999
USA2014250
AFRICA2016300

Here  USA is the first whose sale is less than sale in the First row (i.e 250 < 500).

Hence my solution should be 2014.

Please help.

Thanks a lot in advance.

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Perhaps like this: Min({<Sales={"<$(=Only({<YEAR={$(=FieldValue('YEAR',1))}>}Sales))"}>}Year)


talk is cheap, supply exceeds demand

View solution in original post

6 Replies
Gysbert_Wassenaar

Perhaps like this: Min({<Sales={"<$(=Only({<YEAR={$(=FieldValue('YEAR',1))}>}Sales))"}>}Year)


talk is cheap, supply exceeds demand
swuehl
MVP
MVP

How is 'first row' defined in your application, i.e. is there any sort order of that table?

Not applicable
Author

Hi Gysbert,

Thanks a lot for the response.

This seems to be very helpful.

Not applicable
Author

Hi  Stefan,

No I don't have any sort order in my  table.

Thanks

swuehl
MVP
MVP

Just to note that above uses LOAD order as sort order.

And you might run into troubles if you have YEAR values appear more than once (because of the use of Only() ), like shown for year 2016 in your sample data.

Not applicable
Author

Thanks a lot Stefan for your valuable comments.