Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
surendraj
Specialist
Specialist

First Value in the table

Hi All,

in the below table, i need to capture the first value of the price for every model and month_year in a new field. (need in script level)

For Example:

for a model , if we have price for july2017 then we consider that price . if  july2017 has no price then we capture the price for aug2017  and so on ..

Table.JPG

25 Replies
MK_QSL
MVP
MVP

Provide sample data for this.

stabben23
Partner - Master
Partner - Master

Hi,

maybe you can load it like follow.

MinPrice:

LOAD

Model,

min(Month_Year) as Min_MonthYear,

firstsortedvalue(Price, Month_Year) as Min_Price

Resident Your table

Group by Model;

Then Connect(join) on Model

EDITED!

sunny_talwar

May be Left Join like this

Left Join ( TableName)

LOAD Category,

     Crawler,

     Manufacturer,

     Model,

     FirstSortedValue(Price, - Month_Year) as LatestPrice

Resident TableName

Group By Category, Crawler, Manufacturer, Model;

surendraj
Specialist
Specialist
Author

when i execute this .. no data in Min_Price. .


surendraj
Specialist
Specialist
Author

after exciting this, no data in the latestprice .

sunny_talwar

How about if you do this

Left Join ( TableName)

LOAD Category,

    Crawler,

    Manufacturer,

    Model,

    FirstSortedValue(DISTINCT Price, - Month_Year) as LatestPrice

Resident TableName

Group By Category, Crawler, Manufacturer, Model;

surendraj
Specialist
Specialist
Author

Output should be output.JPG

surendraj
Specialist
Specialist
Author

Output should be

output.JPG

sunny_talwar

Oh, you want the Price at the Min Date... try this

Left Join (TableName)

LOAD Category,

    Crawler,

    Manufacturer,

    Model,

    FirstSortedValue(DISTINCT Price, Month_Year) as LatestPrice

Resident TableName

Where Len(Trim(Price)) > 0

Group By Category, Crawler, Manufacturer, Model;