Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Highlighted
cagataym
New Contributor III

Finding most recent date in a table

I have two tables and I want to print the most recent month from SalesTable

If I had another column marking 'Sold' measure (e.g. Measure) I could do this:

max({<Measure={"Sold"}, YEAR ={$(=max(Year))}>} Month)        -- and this would give me 11

is there a way to pick that most recent month in a table without adding another column?

SalesTable:

Month, Year,  Sold

11, 2018, 29

10,2018, 40

.

.

PlanTable:

Month, Year,  Predicted

12, 2018, 30

11,2018, 45

10,2018, 37

.

.

2 Replies
Partner
Partner

Re: Finding most recent date in a table

I would say it will be easier if you add 1more column.

SalesTable:

Load *,

'Sales' as Source_Flag;

Load * Inline [

Month, Year,  Sold

11, 2018, 29

10,2018, 40

];

.

.

PlanTable:

Load *,

'Plan' as Source_Flag;

Load * Inline [

Month, Year,  Predicted

12, 2018, 30

11,2018, 45

10,2018, 37

];

And in expression you can use

Max({<Source_Flag = {"Sales"}>}Month)

cagataym
New Contributor III

Re: Finding most recent date in a table

I am generating the tables using generic load. Although what you described is also possible with generic load, it makes my script unnessarly long to add new column and drop table.  So if some how its possible to spesify a table that would really solve my problem.