

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Remove rows based on condition
Hi,
I am trying to remove some rows from a phone log. The issue is that when they call from a phone central it logs both on main number and the actual number that that they are calling from. In this case I want to remove the rows with "+4767128800" but keep the row for 8834.
When these duplicates happen the RecNr, Time, LengthOfCall and Direction is always the same.
- « Previous Replies
-
- 1
- 2
- Next Replies »
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You mean to remove them or flag them? I have flagged them using this (Done it in QlikView, but Qlik Sense should be the same)
Table:
LOAD RecNo() as SNo,
id,
caller,
recipient,
starttime,
endtime,
duration,
direction,
recordtype,
Len(PurgeChar(caller, '*')) as LenCaller
FROM
[..\..\Downloads\exampledata.xlsx]
(ooxml, embedded labels, table is Sheet1);
FinalTable:
LOAD *,
If(recipient = Previous(recipient) and starttime = Previous(starttime) and endtime = Previous(endtime) and duration = Previous(duration) and direction = Previous(direction) and LenCaller > 4, 1, 0) as Flag
Resident Table
Order By recipient, starttime, endtime, duration, direction, LenCaller;
DROP Table Table;


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
do you have a separate field that specifies which line was actually used to make the call?
of you could just use
if(len(CallerNR)=4 , CallerNR) and suppress null values on dimension
If a post helps to resolve your issue, please accept it as a Solution.


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
No. That is the statement / condition I am trying to create so that I can flag them and remove them based on that condition.
That would have worked, but the issue is that soemtimes they do use the longer number, but then there isn't any other rows with the exact same timing, lenght of call and receiving number. Their logging is creating a duplicate row with the main number and outgoing number and I am trying to get rid of these duplicates.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
So you are looking to flag them in the script?


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May be like this
LOAD CallerNr,
RecNr,
Time,
LengthOfCall,
Direction,
If(RecNr = Previous(RecNr) and Time = Previous(Time) and LengthOfCall = Previous(LengthOfCall) and Direction = Previous(Direction) and Len(CallerNr) > 4, 1, 0) as Flag
Resident .....
Order By RecNr, Time, LengthOfCall, Direction, CallerNr;


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That would have worked, but it looks like they don't always come in the same order. Long and then short or vice versa. This might be trickier than expected.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I added a Order by statement.... even that won't put them together?


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No...still didn't turn out correct. Added an excel with some demo data. The red marked ones are the ones to be removed here.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You mean to remove them or flag them? I have flagged them using this (Done it in QlikView, but Qlik Sense should be the same)
Table:
LOAD RecNo() as SNo,
id,
caller,
recipient,
starttime,
endtime,
duration,
direction,
recordtype,
Len(PurgeChar(caller, '*')) as LenCaller
FROM
[..\..\Downloads\exampledata.xlsx]
(ooxml, embedded labels, table is Sheet1);
FinalTable:
LOAD *,
If(recipient = Previous(recipient) and starttime = Previous(starttime) and endtime = Previous(endtime) and duration = Previous(duration) and direction = Previous(direction) and LenCaller > 4, 1, 0) as Flag
Resident Table
Order By recipient, starttime, endtime, duration, direction, LenCaller;
DROP Table Table;

- « Previous Replies
-
- 1
- 2
- Next Replies »