Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
rrrggg20
Contributor II
Contributor II

single date column to start and finish date columns

should be simple, but my mind is locked lately.

 

I have a table

Table

Load * inline [

task, date

task1, 1/1/2020

Miltone 1, 2/1/2021

task3, 5/1/2020

task4, 3/1/2020

milestone 2, 3/1/2022

AnothertaskmilstneUnrelated1, 2/3/2024

AnothertaskmilstoneUnrelated2/3/2020

Milestn 4, 3/1/2023

what I am trying to do is pull out the milestone dates and create a start/finish type layout.

note the name is not always "Milestone" so wildmatch('Milestone','') does not work

I am using Match(Task,'Miltone 1','Milestone 2', 'Milestn 4','AnothertaskmilstneUnrelated1','AnothertaskmilstoneUnrelated2')

to pull all the milestones, but what I need is to determine what activities fall between certain milestones

in this case

I need to create start and finishes between the Miltone 1, Milestone 2 and Milestn 4,but not the "unrelated"milestones

what I am hoping for is this

Th

TaskStartEnd 
Miltone 12/1/20212/1/2022(1 Month before Milestone 2 starts  
Milestone 23/1/20222/1/20231 month before milestone 4
Milestone 3  needs to b e here even if blank
Milestn 43/1/2023 no end date
3 Replies
QFabian
MVP
MVP

Hi @rrrggg20  please check this script, this is how it ends :

QFabian_0-1609360393372.png

 

 

Table:
Load * inline [
task, date
task1, 1/1/2020
Miltone 1, 2/1/2021
task3, 5/1/2020
task4, 3/1/2020
milestone 2, 3/1/2022
AnothertaskmilstneUnrelated1, 2/3/2024
AnothertaskmilstoneUnrelated,2/3/2020
Milestn 4, 3/1/2023];

Aux:
Load
KeepChar(task, '1234567890') as Id,
date as Date
Resident Table
Where
upper(task) like 'MIL*';

drop table Table;


Milestone:
Load
Id,
Date as Start,
addmonths(previous(Date),-1) as End
Resident Aux
order by Id desc;


drop table Aux;

 

MaxId:
Load
min(Id) as MinId,
max(Id) as MaxId
Resident Milestone;

Let vMaxId = peek('MaxId', 0, 'MaxId');
Let vMinId = peek('MinId', 0, 'MaxId');


For vId = $(vMinId) to $(vMaxId)
Ids:
Load
$(vId) as Ids
Autogenerate(1);
Next
drop table MaxId;

concatenate(Milestone)
Load
Ids as Id
Resident Ids
where not exists(Id, Ids);

drop table Ids;

Greetings!! Fabián Quezada (QFabian)
did it work for you? give like and mark the solution as accepted.
RogerG
Creator
Creator

sorry I lost access to that account, I would like to ask an admin to accept QFabian's answer

QFabian
MVP
MVP

Thanks!, glad to hear it is was usefull

Greetings!! Fabián Quezada (QFabian)
did it work for you? give like and mark the solution as accepted.