Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

Removing initial entries with value of 0 but not entries in between range

jhwth
6 - Meteoroid

I have a table that shows employee names, work date and the time in minutes they worked for that date:

 

EmployeeDateMinutes
Employee AAug 10
Employee AAug 20
Employee AAug 3500
Employee AAug 4500
Employee AAug 5500
Employee BAug 1100
Employee BAug 2400
Employee BAug 30
Employee BAug 4300
Employee BAug 5300

 

I want to remove the entries they didnt work (minutes = 0) but only if it is before the first day they worked. So for example, I want to remove the Aug 1 and 2 entries for Employee A, but I want to keep the Aug 3 entry for Employee B, since the 0 value is between non-zero values.

9 REPLIES 9
flying008
15 - Aurora

Hi,@jhwth 

 

Please see below gif:

 

录制_2023_02_08_11_44_05_347.gif

 

iif((IsEmpty([Row-1:Minutes]) or [Row-1:Minutes]=0) and [Minutes] =0 ,Null(),[Minutes])

 

******

If it can help you , please mark it as a solution and give a like for more share.

jhwth
6 - Meteoroid

flying008

 

Thank you! This formula was good at removing "leading" zeros, however it removed some of the zeros if they are in between non-zero values, even though they should not be removed.  For example:

 

EmployeeDateTime 
AAug 10this zero should be removed
AAug 20this zero should be removed
AAug 3600 
AAug 4600 
BAug 1300 
BAug 2300 
BAug 30this zero should be kept
BAug 40this zero should be kept
BAug 5400 
flying008
15 - Aurora

Hi, @jhwth 

 

EmployeeDateTime 
A1-Aug0this zero should be removed
A2-Aug0this zero should be removed
A3-Aug600 
A4-Aug600 
B1-Aug0this zero removed or retained?
B2-Aug0this zero removed or retained?
B3-Aug300 
B4-Aug300 
B5-Aug400 
jhwth
6 - Meteoroid

flying008

 

Those 2 zeros you highlighted should be removed. The "leading" zeros per each employee should be removed.

 

ShankerV
17 - Castor

Hi @jhwth 

 

Please find the expected output.

 

ShankerV_0-1675834602127.png

 

 

Input was:

ShankerV_1-1675834619353.png

 

Many thanks

Shanker V

 

ShankerV
17 - Castor

Hi @jhwth 

 

Same workflow tested for your other input too.

 

ShankerV_0-1675834772835.png

 

Input used:

ShankerV_0-1675834903636.png

 

Many thanks

Shanker V

flying008
15 - Aurora

Hi, @jhwth 

 

There is a final way to get your want, even you have many employees or types minutes.

 

录制_2023_02_08_15_58_33_920.gif

 

Hi, @ShankerV 

Thank you for your workflow, but the flow can't match below data:

EmployeeDateMinutes
Employee A1-Aug0
Employee A2-Aug0
Employee A3-Aug0
Employee A4-Aug500
Employee A5-Aug500
Employee B1-Aug0
Employee B2-Aug0
Employee B3-Aug0
Employee B4-Aug300
Employee B5-Aug300

 

********

flying008_0-1675843888936.png

 

ShankerV
17 - Castor

Hi @flying008 

 

Thanks for the notification.

I worked the workflow based on the scenario shared by @jhwth  to accommodate the logic.

 

Have tweaked the formula to accommodate your request too.

Hope it helps!!!!

 

EmployeeDateMinutes
Employee A1-Aug0
Employee A2-Aug0
Employee A3-Aug0
Employee A4-Aug500
Employee A5-Aug500
Employee B1-Aug0
Employee B2-Aug0
Employee B3-Aug0
Employee B4-Aug300
Employee B5-Aug300

 

ShankerV_0-1675863216972.png

flying008
15 - Aurora

Hi, @ShankerV 

 

I guess the logic of @jhwth required like this:

Input    Output   
EmployeeDateMinutes  EmployeeDateMinutesAction
Employee A1-Aug0  Employee A1-Aug0to be removed
Employee A2-Aug0  Employee A2-Aug0to be removed
Employee A3-Aug0  Employee A3-Aug0to be removed
Employee A4-Aug0  Employee A4-Aug0to be removed
Employee A5-Aug500  Employee A5-Aug500 
Employee B1-Aug100  Employee B1-Aug100 
Employee B2-Aug0  Employee B2-Aug0 
Employee B3-Aug0  Employee B3-Aug0 
Employee B4-Aug300  Employee B4-Aug300 
Employee B5-Aug300  Employee B5-Aug300 

 

So there is need  a dynamic solution to figure out the result.

 

录制_2023_02_09_09_21_05_793.gif

 

******

@jhwth  What are you really want ?

Labels
Top Solution Authors