Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

how to get the id

Hi All,

I have the following table:

YearMonth, Date, TimeId,

2015-1-1,2015-1-1,   100

2015-1-1,2015-1-2,  101

2015-1-1,2015-1-3,  102

I want to use Load script to add one more column for it: get the TimeID of the first day of the current month

For this example, that time id should be 100 for each row, how can I achieve it?

Thanks.

4 Replies
PrashantSangle

Hi,

try firstsortedValue(TimeId,YearMonth)

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
qlikmsg4u
Specialist
Specialist

Try this script,

Table1:

load * Inline [

YearMonth, Date, TimeId

2015-1-1,2015-1-1,   100

2015-1-1,2015-1-2,  101

2015-1-1,2015-1-3,  102

2015-2-1,2015-2-4,103

2015-2-1,2015-2-24,104];

Temp:

Mapping load Distinct YearMonth,TimeId Resident Table1;

Load *,ApplyMap('Temp',YearMonth,'Unknown') as New_TimeId Resident Table1;

Drop Table Table1;

tresesco
MVP
MVP

Input:
Load
Date#(Date, 'YYYY-M-D') as Date,
MonthName(Date#(Date, 'YYYY-M-D')) as YearMonth,
TimeId
Inline [
Date, TimeId,
2015-1-1,  100
2015-1-2,  101
2015-1-3,  102
2015-2-4,  104
2015-2-5,  105
2015-2-6,  106
];

Join

Load YearMonth,
  FirstSortedValue(TimeId,Date) as FirstIDofTheMonth
Resident Input Group by YearMonth;

PFA

prashantbaste
Partner - Creator II
Partner - Creator II

Hi

Try this:

MainTable:

Load YearMonth,

      Date,

      TimeId

From table....

join(MainTable)

Load YearMonth,

      Min(TimeId) as NewCol

Resident MainTable

Group By YearMonth;

Hope this will be helpful for you.

--

Regards,

Prashant P Baste