Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
SatyaPaleti
Creator III
Creator III

How to Avoid Repeated values from Timestamp?

Hi Experts,

I had following data.

Test:
LOAD * INLINE
[
Emp ID,Time Stamp
EMP123,2024-01-19 08:24:16
EMP123,2024-01-19 08:28:45
EMP123,2024-01-19 08:28:46
EMP123,2024-01-19 08:28:47
EMP123,2024-01-24 11:58:55
EMP123,2024-01-24 11:58:56
EMP123,2024-01-24 11:59:52
EMP123,2024-01-24 11:59:53
EMP123,2024-01-24 12:00:43
EMP123,2024-01-24 12:00:44

];

Test1:
Load *,
RowNo() as Rowno
Resident Test;
drop table Test;

In the Time Stamp Field we have two different Dates i.e., 2024-01-19 & 2024-01-24. So, when I calculate row number for this table I have to show only count 2 rows because we have two different dates. 

How to avoid repeated values of the single date.

For Example I had 

2024-01-19 08:24:16
2024-01-19 08:28:45
2024-01-19 08:28:46
2024-01-19 08:28:47

I have to consider only one date among these 4

 

2024-01-24 11:58:55
2024-01-24 11:58:56
2024-01-24 11:59:52
2024-01-24 11:59:53
2024-01-24 12:00:43
2024-01-24 12:00:44

 

I have to consider only one date among these 6.

 

So finally Row number of this table should be 2. Could you please help me with your suggestions

Thanks,

Satya

 

 

Labels (3)
15 Replies
qv_testing
Specialist II
Specialist II

Use Distinct like below

Test:
LOAD Distinct [Emp ID], Date(floor(Date#([Time_Stamp], 'YYYY-MM-DD h:mm:ss')),'YYYY-MM-DD') as NewDate;
LOAD * INLINE
[
Emp ID,Time_Stamp
EMP123,2024-01-19 08:24:16
EMP123,2024-01-19 08:28:45
EMP123,2024-01-19 08:28:46
EMP123,2024-01-19 08:28:47
EMP123,2024-01-24 11:58:55
EMP123,2024-01-24 11:58:56
EMP123,2024-01-24 11:59:52
EMP123,2024-01-24 11:59:53
EMP123,2024-01-24 12:00:43
EMP123,2024-01-24 12:00:44

];

Test1:
Load *,
RowNo() as Rowno
Resident Test;
drop table Test;

qv_testing_0-1706540160499.png

 

PrashantSangle

Try below

Test:
Load Distinct [Emp ID], NewDate;
LOAD [Emp ID], Date(floor(Date#([Time_Stamp], 'YYYY-MM-DD h:mm:ss')),'YYYY-MM-DD') as NewDate;
LOAD * INLINE
[
Emp ID,Time_Stamp
EMP123,2024-01-19 08:24:16
EMP123,2024-01-19 08:28:45
EMP123,2024-01-19 08:28:46
EMP123,2024-01-19 08:28:47
EMP123,2024-01-24 11:58:55
EMP123,2024-01-24 11:58:56
EMP123,2024-01-24 11:59:52
EMP123,2024-01-24 11:59:53
EMP123,2024-01-24 12:00:43
EMP123,2024-01-24 12:00:44
];

NoConcatenate
Final:
//Load *,RowNo() as RowNo;
Load Distinct [Emp ID], NewDate,RowNo() as RowNo
Resident Test;

Drop Table Test;

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 🙂
SatyaPaleti
Creator III
Creator III
Author

No Luck Prashanth

Ahidhar
Creator III
Creator III

try this

Test:
load [Time Stamp],only([Emp ID]) as [Emp ID] group by [Time Stamp];
load [Emp ID],floor(Timestamp#([Time Stamp],'YYYY-MM-DD hh:mm:ss')) as [Time Stamp];
LOAD * INLINE
[
Emp ID,Time Stamp
EMP123,2024-01-19 08:24:16
EMP123,2024-01-19 08:28:45
EMP123,2024-01-19 08:28:46
EMP123,2024-01-19 08:28:47
EMP123,2024-01-24 11:58:55
EMP123,2024-01-24 11:58:56
EMP123,2024-01-24 11:59:52
EMP123,2024-01-24 11:59:53
EMP123,2024-01-24 12:00:43
EMP123,2024-01-24 12:00:44
];

Test1:
load [Emp ID],[Time Stamp]
,RowNo() as rowno
resident Test;drop table Test;

vinieme12
Champion III
Champion III

Use floor() instead

 

Date(floor(Timestamp#([Time Stamp],'YYYY-MM-DD h:mm:ss'))) as DateIs

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

@SatyaPaleti Perhaps this?

Test:
LOAD *,AutoNumber(Date(Floor("Time Stamp")), IterNo()) as RowNo INLINE
[
Emp ID,Time Stamp
EMP123,2024-01-19 08:24:16
EMP123,2024-01-19 08:28:45
EMP123,2024-01-19 08:28:46
EMP123,2024-01-19 08:28:47
EMP123,2024-01-24 11:58:55
EMP123,2024-01-24 11:58:56
EMP123,2024-01-24 11:59:52
EMP123,2024-01-24 11:59:53
EMP123,2024-01-24 12:00:43
EMP123,2024-01-24 12:00:44
];

 

Output looks like this, In case this is not expected, please add the output column that you need.

Anil_Babu_Samineni_0-1706626490702.png

 

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful